Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How can I plot the frequency from a time sere?

0 views
Skip to first unread message

Dias Papas

unread,
Nov 9, 2009, 8:56:01 AM11/9/09
to
Hi,
I think I have an easy question but I am really confused.

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

Matt Fetterman

unread,
Nov 9, 2009, 9:44:02 AM11/9/09
to
"Dias Papas" <dias_...@mathworks.com> wrote in message <hd971h$shm$1...@fred.mathworks.com>...

Take a look at this thread:
http://www.mathworks.com/matlabcentral/newsreader/view_thread/254412

Dias Papas

unread,
Nov 9, 2009, 3:00:20 PM11/9/09
to
"Matt Fetterman" <mattin...@yahoo.com> wrote in message <hd99ri$src$1...@fred.mathworks.com>...

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

Matt Fetterman

unread,
Nov 9, 2009, 3:17:19 PM11/9/09
to
"Dias Papas" <dia...@topo.auth.gr> wrote in message <hd9sck$4dt$1...@fred.mathworks.com>...

%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

Dias Papas

unread,
Nov 10, 2009, 2:08:04 PM11/10/09
to
"Matt Fetterman" <mattin...@yahoo.com> wrote in message <hd9tcf$7a6$1...@fred.mathworks.com>...

Thanks a lot Matt

Dias

Gagan

unread,
Feb 17, 2010, 5:37:02 AM2/17/10
to
"Matt Fetterman" <mattin...@yahoo.com> wrote in message <hd9tcf$7a6$1...@fred.mathworks.com>...

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! :)

0 new messages