I transfer a time sere (e.g. x=randn(100,1) ) with fft() or freqz() in the frequency domain.
If i command plot(abs(fft(x))),in the figure on the x axis will be the n(=1000) length of x and on the y axis will be the values of x in frequency domain in Hz?
If not how can i plot that so in the y axis will be values in Hz?
Thanks a lot
Dias
Take a look at this thread:
http://www.mathworks.com/matlabcentral/newsreader/view_thread/254412
Matt thanks a lot.
I saw the link you ve send me and i tried to study it but to tell you the truth i am still confused. It was too 'specialized'.
If you have anything else in mind i would be grateful.
Thank you very much
Dias
%First define a time array. For example, let the time difference between points be dt, %in seconds. We can take dt=0.001, for 1ms. We take N=1000points.
t=[1:N]*dt;
% Now a function. Call Afreq=10, for 10Hz sinusoid
f=sin(t*Afreq*2*pi)
figure(1);
plot(t,f);xlabel('time (s)')';ylabel('amplitude');
% And now take the fft.
Pfreq=fftshift(fft(f));
% construct the frequency axis as described in the previous link.
FrequencyAxis=( -ceil((N-1)/2):N-1-ceil((N-1)/2) )/(N*dt);
figure(2);
% and plot the fft. And you can see our 10Hz oscillation.
plot(FrequencyAxis,abs(Pfreq));xlabel('Freq(Hz)')';ylabel('amplitude');
% Regards Matt
Thanks a lot Matt
Dias
Matt,
I know its been some time since this thread was open for discussion but I wanted to ask a problem similar to this...
If say the function f was actually the plot of pixel intensities (say one column of pixel intensities) then how would I be able to define the value of dt? I need to find the transform of the pixel line profile to the frequency domain...
Thank you for your help anyway! :)