Thread Subject: How to improve the fft resolution at low frequencies

Subject: How to improve the fft resolution at low frequencies

From: Ahmed

Date: 23 Nov, 2009 10:48:04

Message: 1 of 7

Currently, I’m collecting my data from a Simulink model. My code is as follow:

Fs = 50; % Sampling frequency
Ts = 1/Fs; % Sample time
L = 200; % Time Length of signal (sec)
t = 0:Ts:L-Ts; t = t'; % time
n = L/Ts; % number of samples
NFFT = 2^nextpow2(n); % Next power of 2 from length of y
f = Fs/2*linspace(0,1,NFFT/2+1); f=f'; % frequency vector
w = 2*pi*f; %rad/s
sim Model_ID.mdl
win = hann(n);
Y0 = fft(y0.*win,NFFT);
U0 = fft(u0.*win,NFFT);
G0 = Y0./U0;

When I looked at the frequency response of the model coming from (G0) and compared it with the actual frequency response, I found that the accuracy of the frequency response of those frequencies lower than 1Hz are very poor.

Could you please give me any advice to improve the low frequency resolution?

Subject: How to improve the fft resolution at low frequencies

From: Dave Robinson

Date: 23 Nov, 2009 13:29:05

Message: 2 of 7

"Ahmed " <fahmy120@yahoo.com> wrote in message <hedp93$ehe$1@fred.mathworks.com>...
> Currently, I’m collecting my data from a Simulink model. My code is as follow:
>
> Fs = 50; % Sampling frequency
> Ts = 1/Fs; % Sample time
> L = 200; % Time Length of signal (sec)
> t = 0:Ts:L-Ts; t = t'; % time
> n = L/Ts; % number of samples
> NFFT = 2^nextpow2(n); % Next power of 2 from length of y
> f = Fs/2*linspace(0,1,NFFT/2+1); f=f'; % frequency vector
> w = 2*pi*f; %rad/s
> sim Model_ID.mdl
> win = hann(n);
> Y0 = fft(y0.*win,NFFT);
> U0 = fft(u0.*win,NFFT);
> G0 = Y0./U0;
>
> When I looked at the frequency response of the model coming from (G0) and compared it with the actual frequency response, I found that the accuracy of the frequency response of those frequencies lower than 1Hz are very poor.
>
> Could you please give me any advice to improve the low frequency resolution?

Sample for a longer period of time. Your frequency resolution is equal to the reciprical of the time taken to acquire the signal that you are applying your FFT on.

Hope that helps

Dave Robinson

Subject: How to improve the fft resolution at low frequencies

From: Lorenzo Guerrasio

Date: 23 Nov, 2009 14:48:23

Message: 3 of 7

"Ahmed " <fahmy120@yahoo.com> wrote in message <hedp93$ehe$1@fred.mathworks.com>...
> Currently, I’m collecting my data from a Simulink model. My code is as follow:
>
> Fs = 50; % Sampling frequency
> Ts = 1/Fs; % Sample time
> L = 200; % Time Length of signal (sec)
> t = 0:Ts:L-Ts; t = t'; % time
> n = L/Ts; % number of samples
> NFFT = 2^nextpow2(n); % Next power of 2 from length of y
> f = Fs/2*linspace(0,1,NFFT/2+1); f=f'; % frequency vector
> w = 2*pi*f; %rad/s
> sim Model_ID.mdl
> win = hann(n);
> Y0 = fft(y0.*win,NFFT);
> U0 = fft(u0.*win,NFFT);
> G0 = Y0./U0;
>
> When I looked at the frequency response of the model coming from (G0) and compared it with the actual frequency response, I found that the accuracy of the frequency response of those frequencies lower than 1Hz are very poor.
>
> Could you please give me any advice to improve the low frequency resolution?

It is not clear to me why you multply input and output by a window. Did you awnt to do perodogram estimation?in that case you should use the periodogram command.

Subject: How to improve the fft resolution at low frequencies

From: Ahmed

Date: 23 Nov, 2009 22:13:19

Message: 4 of 7

"Lorenzo Guerrasio" <lorenzo.guerrasio@email.it> wrote in message <hee7bn$l3u$1@fred.mathworks.com>...
> "Ahmed " <fahmy120@yahoo.com> wrote in message <hedp93$ehe$1@fred.mathworks.com>...
> > Currently, I’m collecting my data from a Simulink model. My code is as follow:
> >
> > Fs = 50; % Sampling frequency
> > Ts = 1/Fs; % Sample time
> > L = 200; % Time Length of signal (sec)
> > t = 0:Ts:L-Ts; t = t'; % time
> > n = L/Ts; % number of samples
> > NFFT = 2^nextpow2(n); % Next power of 2 from length of y
> > f = Fs/2*linspace(0,1,NFFT/2+1); f=f'; % frequency vector
> > w = 2*pi*f; %rad/s
> > sim Model_ID.mdl
> > win = hann(n);
> > Y0 = fft(y0.*win,NFFT);
> > U0 = fft(u0.*win,NFFT);
> > G0 = Y0./U0;
> >
> > When I looked at the frequency response of the model coming from (G0) and compared it with the actual frequency response, I found that the accuracy of the frequency response of those frequencies lower than 1Hz are very poor.
> >
> > Could you please give me any advice to improve the low frequency resolution?
>
> It is not clear to me why you multply input and output by a window. Did you awnt to do perodogram estimation?in that case you should use the periodogram command.

Dear Lorenzo;
Thank you very much for your help. I’m using window function to smooth the fft. As far as I know, periodogram command interested in the magnitude only. I’m not sure from where we can get the phase if we use periodogram to calculate the FRF. Could you please write what you mean in as a short code?

Subject: How to improve the fft resolution at low frequencies

From: Lorenzo Guerrasio

Date: 23 Nov, 2009 23:15:20

Message: 5 of 7

"Ahmed " <fahmy120@yahoo.com> wrote in message <hef1dv$ceb$1@fred.mathworks.com>...
> "Lorenzo Guerrasio" <lorenzo.guerrasio@email.it> wrote in message <hee7bn$l3u$1@fred.mathworks.com>...
> > "Ahmed " <fahmy120@yahoo.com> wrote in message <hedp93$ehe$1@fred.mathworks.com>...
> > > Currently, I’m collecting my data from a Simulink model. My code is as follow:
> > >
> > > Fs = 50; % Sampling frequency
> > > Ts = 1/Fs; % Sample time
> > > L = 200; % Time Length of signal (sec)
> > > t = 0:Ts:L-Ts; t = t'; % time
> > > n = L/Ts; % number of samples
> > > NFFT = 2^nextpow2(n); % Next power of 2 from length of y
> > > f = Fs/2*linspace(0,1,NFFT/2+1); f=f'; % frequency vector
> > > w = 2*pi*f; %rad/s
> > > sim Model_ID.mdl
> > > win = hann(n);
> > > Y0 = fft(y0.*win,NFFT);
> > > U0 = fft(u0.*win,NFFT);
> > > G0 = Y0./U0;
> > >
> > > When I looked at the frequency response of the model coming from (G0) and compared it with the actual frequency response, I found that the accuracy of the frequency response of those frequencies lower than 1Hz are very poor.
> > >
> > > Could you please give me any advice to improve the low frequency resolution?
> >
> > It is not clear to me why you multply input and output by a window. Did you awnt to do perodogram estimation?in that case you should use the periodogram command.
>
> Dear Lorenzo;
> Thank you very much for your help. I’m using window function to smooth the fft. As far as I know, periodogram command interested in the magnitude only. I’m not sure from where we can get the phase if we use periodogram to calculate the FRF. Could you please write what you mean in as a short code?


Hallo,
Unfortunaltely my memories of signal spectral analysis are quite old.
As far as I remember, if you estimate the spectrum from the time series you have two problems i.e., spectral bias and variance of the spectrum. While the bias of the spectrum might be solved by your smoothing, in order to reduce variance you have to average several estimation of the spectrum. You'll lose resultuion, you'll gain recision. therefore I'd suggest you to look at the Bartlett's or the Welch's method if you have a problem of precision (and not of resolution, which I reckon can be solved adding more sample, or eventually zero padding).
All of this regards power spectrum, not the phase. I'm sorry, but I don't know much aobut phase spectrum estimation.Besides, in your code the phase problems does not appear to be treated (Am I wrong).
i hope you could find the help you need. Eventually write a second,more specific question, if more expert people does not contribute to this more general request.
All best
L

Subject: How to improve the fft resolution at low frequencies

From: Rune Allnor

Date: 23 Nov, 2009 23:21:12

Message: 6 of 7

On 23 Nov, 11:48, "Ahmed " <fahmy...@yahoo.com> wrote:

> Could you please give me any advice to improve the low frequency resolution?

The only way is to use a longer observation. It's as
simple as that. This is a fundamental property of any
methods that are based on the DFT.

Rune

Subject: How to improve the fft resolution at low frequencies

From: dbd

Date: 24 Nov, 2009 02:31:48

Message: 7 of 7

On Nov 23, 3:21 pm, Rune Allnor <all...@tele.ntnu.no> wrote:
> On 23 Nov, 11:48, "Ahmed " <fahmy...@yahoo.com> wrote:
>
> > Could you please give me any advice to improve the low frequency resolution?
>
> The only way is to use a longer observation. It's as
> simple as that. This is a fundamental property of any
> methods that are based on the DFT.
>
> Rune

Getting more samples is almost always the easiest way. There has been
some work on algorithmic techniques. See:

http://www.aes.org/e-lib/browse.cfm?elib=13768

Dale B. Dalrymple

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
phase spectrum ... Lorenzo Guerrasio 23 Nov, 2009 18:19:21
improve fft res... Ahmed Abass 23 Nov, 2009 05:49:08
rssFeed for this Thread

Contact us at files@mathworks.com