A very simple MATLAB experiment:
f = 200;
fs = 1000;
t = 0: 1/fs : 1;
x = cos(2*pi*f*t);
plot(angle(fftshift(fft(x))));
And here's the output:
Now, made a minor change to the above code snippet; reducing the time duration by just 1 sample, as follows:
f = 200;
fs = 1000;
t = 0: 1/fs : 1 - 1/fs;
x = cos(2*pi*f*t);
plot(angle(fftshift(fft(x))));
And the phase spectrum goes totally crazy:
Questions:
In the first plot, I was hoping to see a zero phase at bin 700 which corresponds to the positive frequency of 200 in this example. That doesn't seem to be the case. Secondly, I don't understand the linear parts of the graph in plot 1. I do appreciate phase components that could potentially exist due to the so-called numerical noise, but then how could that noise be so 'linear' in phase?
In the second plot, why removing just one sample would have such a drastic impact on the phase plot?
Am I doing something fundamentally wrong here?
No comments:
Post a Comment