Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.



Re: Phase Angle Plot of fft
Posted:
Oct 1, 2013 3:54 PM


On Wednesday, October 2, 2013 8:40:10 AM UTC+13, J wrote: > "someone" wrote in message <l2f69d$8mk$1@newscl01ah.mathworks.com>... > > > "J " <jr360983@dal.ca> wrote in message <l2f4mm$3ki$1@newscl01ah.mathworks.com>... > > > > Hi, > > > > > > > > I am trying to plot the phase angle of an fft, the values I'm getting in radians don't seem to be right? > > > > > > > > Here is my code: > > > > > > > > Fs = 1000; % Sampling frequency > > > > T = 1/Fs; % Sample time > > > > L = 1000; % Length of signal > > > > t = (0:L1)*T; % Time vector > > > > % Sum of a 50 Hz sinusoid and a 120 Hz sinusoid > > > > x = 0.7*sin(2*pi*50*t) + sin(2*pi*120*t); > > > > y = x + 2*randn(size(t)); % Sinusoids plus noise > > > > plot(Fs*t(1:50),y(1:50)) > > > > title('Signal Corrupted with ZeroMean Random Noise') > > > > xlabel('time (milliseconds)') > > > > > > > > > > > > NFFT = 2^nextpow2(L); % Next power of 2 from length of y > > > > Y = fft(y,NFFT)/L; > > > > f = Fs/2*linspace(0,1,NFFT/2+1); > > > > > > > > %Phase Angle > > > > phi = unwrap(angle(Y(1:NFFT/2+1))); > > > > > > > > % Plot singlesided amplitude spectrum. > > > > figure; > > > > plot(f,2*abs(Y(1:NFFT/2+1))) > > > > title('SingleSided Amplitude Spectrum of y(t)') > > > > xlabel('Frequency (Hz)') > > > > ylabel('Y(f)') > > > > > > > > figure; > > > > plot(f, phi); > > > > > > > > Any insight would help. > > > > > > > > Thanks, > > > > J > > > > > > > > > > > > > > > > > > Why do you think they are not right? > > > > > > > > Because I figured all the values would fall between Pi and negative Pi
Then why bother to unwrap?



