DSPRelated.com
Forums

fft problem

Started by ilker tanyer March 22, 2007
Hi,

I have a fourier transform problem in Matlab. I have time domain data of a system and i want to see the frequency response of the system. I tried many codes, but the magnitude or natural frequencies were not correct.
I m sending a sample time domain data attachment. "h.rtf" consists the time domain response, and "t.rtf" consists the time axis.(Please open them with WordPad or Matlab)

And the following code gives the correct frequency response of the sample data.

In short, i want to rewrite the following code by using "fft" command instead of "freqresp" command in Matlab. Could you help me about this subject ? Thanks a lot..

clear
M=1;
C=1;
K0;
I=1;
zer=0;
A1=inv(M)*C;
A0=inv(M)*K;
A=[-A1 -A0;I zer];
B=[inv(M);zer];
C=[-A1 -A0];
D=[inv(M)];
sys=ss(A,B,C,D);
w=1:100;
H=freqresp(sys,w);
H=squeeze(H);
plot(w,abs(H))
First of all your time axis is uniform. So we need not worry about the
time instant. The samples can be indexed with a positive integer: x(n).

Now suppose your sample is of length N. So we can view this as a
discrete time signal with a window of length applied to it. i.e. the
sample values outside the window being zero. So if you take the fft it
will show you what is known as the Gibbs phenomenon due to the sharp
transition of the window function. So you should apply some other
window function to the x(n) say a Gaussian window w(n) so the resultant
signal y(n)=x(n).w(n). Now take the fft of this.

Now if your sampling rate is Fs (sampling time Ts = 1/Fs) then the fft
output will give you frequency response at frequencies 0 to Fs/2 in
steps of Fs/N. Assuming you are taking a N point fft (sample length). So
if the signal is a single tone then the frequency of the tone will be
(fft index * Fs/N). You can chose fft point to be different than the N.

I hope this resolve your confusion.

Thanks and Regards,

Amit Shaw

From: m... [mailto:m...] On Behalf
Of ilker tanyer
Sent: Wednesday, March 21, 2007 7:36 PM
To: m...
Subject: [matlab] fft problem

Hi,

I have a fourier transform problem in Matlab. I have time domain data of
a system and i want to see the frequency response of the system. I tried
many codes, but the magnitude or natural frequencies were not correct.
I m sending a sample time domain data attachment. "h.rtf" consists the
time domain response, and "t.rtf" consists the time axis.(Please open
them with WordPad or Matlab)

And the following code gives the correct frequency response of the
sample data.

In short, i want to rewrite the following code by using "fft" command
instead of "freqresp" command in Matlab. Could you help me about this
subject ? Thanks a lot..
clear
M=1;
C=1;
K0;
I=1;
zer=0;
A1=inv(M)*C;
A0=inv(M)*K;
A=[-A1 -A0;I zer];
B=[inv(M);zer];
C=[-A1 -A0];
D=[inv(M)];
sys=ss(A,B,C,D);
w=1:100;
H=freqresp(sys,w);
H=squeeze(H);
plot(w,abs(H))

**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
h...@ittiam.com.
**********************************************************************