COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### Solving SDOF system in freq domain using FFT & IFFT

• Email
• Follow

```Hello,
So I want to use FFT & IFFT to solve a simple SDOF system (so that i can move on and use a freq domain method to solve more complex dynamic models). I've solved a simple SDOF system with a sin wave forcing function in time domain using ode45 and then was looking to get the same results using freq domain approach using a FFT and IFFT method,
Im aware of the method, transform the input time history
p(t)-FFT-P(w)
Calculate the response of the SDOF system in the frequency domain using the transfer (frequency response) function
U(w)=H(w)P(w)
Use the inverse FFT to obtain the response of the SDOF system in the time domain
U(w)-IFFT-u(t)

And my code is as follow

%frequency domain

function freqsdof ()

m = 2;
k = 10;
c = 0.26;

wn = sqrt(k/m);  %nat freq
I = c/(2*m*wn);

t = linspace(1,100,10000);
dt = t(1,2) - t(1,1);
% dt = 1;
f = sin(t);

ff =  (f/m) ; %load divided by mass

Qi = fft((ff)) ;

N  = length(f);
fs = 1/(dt);
Q_hertz = ( 0:(N-1) )*fs/N; %Freq in Herz
Q_w = 2*pi*Q_hertz ;        %Cir freq in rads per second

Qf = Qi(1: ceil(N/2));

wQ = Q_w(1: ceil(N/2));

m = length (Qf);

for n = 1:m

X1(n,1)   = ( ( (wn^2 - wQ(1,n)^2) + (i*2*I*wn*wQ(1,n)) )^-1   *(Qf(1,n)) );

%Conjugates of above line
X2(n,1) =  ( ( (wn^2 - wQ(1,n)^2) - (i*2*I*wn*wQ(1,n)))^-1 * conj(Qf(1,n)));

end

x (1:m,1) =  X1(:,1);
x ( ((m+1):(m*2)),1 ) =  X2(:,1);

x1 = ifft( x );

tspan = linspace(1,100,(2*m));

figure
plot ( tspan, real(x1) );
title('Freq domain')

end

However im not getting the right results,
I think the problem is where i have to get the complex conjugate of the values.

```
 0
Reply Michael 6/3/2010 9:46:06 AM

See related articles to this posting

```Did you find a solution to this issue? I am struggling with the same problem.

"Michael Harte" wrote in message <hu7tku\$inq\$1@fred.mathworks.com>...
> Hello,
> So I want to use FFT & IFFT to solve a simple SDOF system (so that i can move on and use a freq domain method to solve more complex dynamic models). I've solved a simple SDOF system with a sin wave forcing function in time domain using ode45 and then was looking to get the same results using freq domain approach using a FFT and IFFT method,
> Im aware of the method, transform the input time history
> p(t)-FFT-P(w)
> Calculate the response of the SDOF system in the frequency domain using the transfer (frequency response) function
> U(w)=H(w)P(w)
> Use the inverse FFT to obtain the response of the SDOF system in the time domain
> U(w)-IFFT-u(t)
>
> And my code is as follow
>
> %frequency domain
>
> function freqsdof ()
>
> m = 2;
> k = 10;
> c = 0.26;
>
> wn = sqrt(k/m);  %nat freq
> I = c/(2*m*wn);
>
> t = linspace(1,100,10000);
> dt = t(1,2) - t(1,1);
> % dt = 1;
> f = sin(t);
>
> ff =  (f/m) ; %load divided by mass
>
> Qi = fft((ff)) ;
>
> N  = length(f);
> fs = 1/(dt);
> Q_hertz = ( 0:(N-1) )*fs/N; %Freq in Herz
> Q_w = 2*pi*Q_hertz ;        %Cir freq in rads per second
>
>
> Qf = Qi(1: ceil(N/2));
>
> wQ = Q_w(1: ceil(N/2));
>
>
> m = length (Qf);
>
>
> for n = 1:m
>
>
> X1(n,1)   = ( ( (wn^2 - wQ(1,n)^2) + (i*2*I*wn*wQ(1,n)) )^-1   *(Qf(1,n)) );
>
>              %Conjugates of above line
>  X2(n,1) =  ( ( (wn^2 - wQ(1,n)^2) - (i*2*I*wn*wQ(1,n)))^-1 * conj(Qf(1,n)));
>
> end
>
>
>
> x (1:m,1) =  X1(:,1);
> x ( ((m+1):(m*2)),1 ) =  X2(:,1);
>
>
> x1 = ifft( x );
>
> tspan = linspace(1,100,(2*m));
>
> figure
>   plot ( tspan, real(x1) );
> title('Freq domain')
>
>
> end
>
>
> However im not getting the right results,
> I think the problem is where i have to get the complex conjugate of the values.
>
> Thanks in advance!
```
 0
Reply ijssebrand (1) 10/9/2013 8:40:09 AM

1 Replies
608 Views

Similar Articles

11/30/2013 1:18:05 PM
page loaded in 26959 ms. (0)