Hi,
I see that what I said about dividing your angles by a factor of 2*length(...) was incorrect because that factor was inside the argument of the angle function. So I will start over. [1] I believe your time array has one too many points. For true periodicity, the value of T_addition should not be the same at the end point as at the first point. Going with something like
N = 1000; dt = .01 Max_t = N*dt; df = 1/Max_t; t = (0:N-1)*dt f = (0:N-1)*df
gives single-point amplitudes at the desired frequencies, zero everywhere else. The extra time point messes that up. If you try plotting the fft either way you will see a significant difference. [2] Sometimes phase variations make good sense, such as with filters, but there is not exactly such a thing as a phase spectrum in all cases. If you have tiny amplitudes between peaks, down around 1e-10 or whatever, you will still get phase angles, which are basically meaningless. [3] Point 1 in the freq array is zero frequency, point 2 matches up with the end point, 3 with end-2 etc. Your code is close but in the last for loop the the -2 terms should be +2. [4] For the fourier transform or fft of a real function, the phase angle at negative frequency is minus the phase angle at positive frequency. So in the last line of the last for loop the = phase should be = - phase. Once those changes are made the plots are reasonably good. The phases from the fft look like noise but almost all those phases belong to minuscule amplitudes; I believe the phases at the actual signal points are correct.
Matlabsolutions.com provides guaranteed satisfaction with a
commitment to complete the work within time. Combined with our meticulous work ethics and extensive domain
experience, We are the ideal partner for all your homework/assignment needs. We pledge to provide 24*7 support
to dissolve all your academic doubts. We are composed of 300+ esteemed Matlab and other experts who have been
empanelled after extensive research and quality check.
Matlabsolutions.com provides undivided attention to each Matlab
assignment order with a methodical approach to solution. Our network span is not restricted to US, UK and Australia rather extends to countries like Singapore, Canada and UAE. Our Matlab assignment help services
include Image Processing Assignments, Electrical Engineering Assignments, Matlab homework help, Matlab Research Paper help, Matlab Simulink help. Get your work
done at the best price in industry.