MATLAB: Do I get a phase = 0 when I add a constant to a sinusoidal wave

fftphasesinusoidal

Hi everyone, say you have x = A*sin(wt + phi) + A0 where A0 is a constant. When I do fft on x and try to get the phase, I always get 0. Why is that? Is it because the wave is shifted up so it is no longer considered a sinusoidal wave? Thank you

Best Answer

That should not happen
Fs = 1000;
t = 0:1/Fs:1-1/Fs;
x = 2+cos(2*pi*100*t-pi/4);
xdft = fft(x);
% now look at the DFT corresponding to 100 Hz
xdft(101)
angle(xdft(101))
Can you please show your code, as you see above, adding a DC shift does not give you a phase of 0.