Hi, I'm trying to write a Matlab program with the following objective: determine the effect of phase error in the resulting current obtained from sin(nwt)-sin(nwt+phi). I've managed to write a program where i can see the effect of increasing values of phi=phase error, However, i'm am unable to generate a graph showing the max value of residual current for different phase error. The problem that the program is a loop and i'm unable to save the max value for each phase error. The value which remains each time is the last value. I'm wondering if there is a way such as in C where u can defined the size of an array to store data for each loop increment. I've tried to use save but i still get the value from the last iteration. Is there any way to recover the data from each iteration. I've attached the mfile I'm using. Thanks.