Calculating steady state response to periodic force input (mass spring damper system)

10 views (last 30 days)
I am trying to calculate the steady state response for the system defined in my code below to a periodic force of cos(t) using fft.
if true
% code
end
m=4;
k=256;
c=1;
wn=sqrt(k/m);
z=c/2/sqrt(m*k);
wd=wn*sqrt(1-z^2);
w=sqrt(4*k*m-c^2)/(2*m);
x0=0;
v0=0;
%%%%%%%%%%%%%%%%%%%%%%%%%
n=100;
t=0:1/n:2*pi;
f=cos(t);
F=fft(f);
h=1/m/wd*exp(-z*wn*t).*sin(wd*t);
H=fft(h);
conv=H.*F;
plot(t,ifft(conv))
HERE is the numerical solution using RK4 method. You can see the system reaches a steady state response to the cos(t) input force.
I expect to see that steady state response using this fft method above but what i get is the following:
The amplitude is way off, so i know i am doing something wrong.
(My goal is to use FFT function to get the periodic steady state response)
So what am i doing wrong? How can i properly use fft to find the solution? and how can i plot the solution for more than one period without changing the t vector? When i change the max t from 2*pi to lets say... 10*pi, it changes the plot to a greater amplitude! Why is this?! Do i have to perform the convolution over 1 period (0:1/N:2*pi) or does this not matter at all? Are there benefits to increasing this range, or does it matter since the Fourier transform assumes periodic input? I am pretty confused and uneducated on this topic, so help would be appreciated!

Answers (0)

Categories

Find more on Fourier Analysis and Filtering in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!