Thread Subject: How can I plot the frequency from a time sere?

Subject: How can I plot the frequency from a time sere?

From: Dias Papas

Date: 9 Nov, 2009 13:56:01

Message: 1 of 6

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

Subject: How can I plot the frequency from a time sere?

From: Matt Fetterman

Date: 9 Nov, 2009 14:44:02

Message: 2 of 6

"Dias Papas" <dias_papas@mathworks.com> wrote in message <hd971h$shm$1@fred.mathworks.com>...
> 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

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

Subject: How can I plot the frequency from a time sere?

From: Dias Papas

Date: 9 Nov, 2009 20:00:20

Message: 3 of 6

"Matt Fetterman" <mattinjersey@yahoo.com> wrote in message <hd99ri$src$1@fred.mathworks.com>...
> "Dias Papas" <dias_papas@mathworks.com> wrote in message <hd971h$shm$1@fred.mathworks.com>...
> > 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
>
> 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

Subject: How can I plot the frequency from a time sere?

From: Matt Fetterman

Date: 9 Nov, 2009 20:17:19

Message: 4 of 6

"Dias Papas" <diapapa@topo.auth.gr> wrote in message <hd9sck$4dt$1@fred.mathworks.com>...
> "Matt Fetterman" <mattinjersey@yahoo.com> wrote in message <hd99ri$src$1@fred.mathworks.com>...
> > "Dias Papas" <dias_papas@mathworks.com> wrote in message <hd971h$shm$1@fred.mathworks.com>...
> > > 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
> >
> > 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

Subject: How can I plot the frequency from a time sere?

From: Dias Papas

Date: 10 Nov, 2009 19:08:04

Message: 5 of 6

"Matt Fetterman" <mattinjersey@yahoo.com> wrote in message <hd9tcf$7a6$1@fred.mathworks.com>...
> "Dias Papas" <diapapa@topo.auth.gr> wrote in message <hd9sck$4dt$1@fred.mathworks.com>...
> > "Matt Fetterman" <mattinjersey@yahoo.com> wrote in message <hd99ri$src$1@fred.mathworks.com>...
> > > "Dias Papas" <dias_papas@mathworks.com> wrote in message <hd971h$shm$1@fred.mathworks.com>...
> > > > 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
> > >
> > > 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

Subject: How can I plot the frequency from a time sere?

From: Gagan

Date: 17 Feb, 2010 10:37:02

Message: 6 of 6

"Matt Fetterman" <mattinjersey@yahoo.com> wrote in message <hd9tcf$7a6$1@fred.mathworks.com>...
> "Dias Papas" <diapapa@topo.auth.gr> wrote in message <hd9sck$4dt$1@fred.mathworks.com>...
> > "Matt Fetterman" <mattinjersey@yahoo.com> wrote in message <hd99ri$src$1@fred.mathworks.com>...
> > > "Dias Papas" <dias_papas@mathworks.com> wrote in message <hd971h$shm$1@fred.mathworks.com>...
> > > > 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
> > >
> > > 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

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

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
frequency Dias Papas 9 Nov, 2009 08:59:12
signal processing Dias Papas 9 Nov, 2009 08:59:12
rssFeed for this Thread

Contact us at files@mathworks.com