Fourier transform of impulse response
Fourier transform of impulse response
(OP)
If I take the fft of the impulse response of
x(t)=(1/(m*wd))*exp(-zeta*wn*t)*sin(wd*t)
I should get
G(jw)=1/(m*(-w^2+wn^2+2*zeta*wn*w*i))]
in the frequency domain. I have not been able to accomplish this using the following code. Anyone have any ideas?
clear
k=25;
m=1;
c=1;
wn=sqrt(k/m);
zeta=c/(2*sqrt(k*m));
fstart=-2.3873; %Start frequency
fend=2.3873; %End frequncy
K=16; %Number of points
f=linspace(fstart,fend,K);
w=2*pi.*f;
delta_f=(fend-fstart)/K;
G=1./(m.*(-w.^2+2.*zeta.*wn.*w.*i+wn.^2));
mag=abs(G);
tstart=0;
tend=10;
N=16;
%%%%%%%%%%%%%%%%%%%%
%%%%%Calculations
wn=sqrt(k/m);
zeta=c./(2.*sqrt(k*m))
wd=wn.*sqrt(1-zeta.^2);
delta_t=(tend-tstart)/N;
t=linspace(tstart,tend,N);
%%%%%%%%%%%%%%%%%%%%
%%%%%%Impulse Response of a 1DOF system
x=exp(-zeta.*wn.*t).*sin(wd.*t)./(m.*wd);
plot(t,x)
FRF=fft(x,N).*delta_t;
magexp=abs(FRF);
figure(1)
semilogy(w,magexp)
hold on
semilogy(w,mag,'k')
legend('exp','theoretical')
figure(2)
irf=ifft(G)./delta_f;
plot(real(irf))
hold on
plot(x,'k')
x(t)=(1/(m*wd))*exp(-zeta*wn*t)*sin(wd*t)
I should get
G(jw)=1/(m*(-w^2+wn^2+2*zeta*wn*w*i))]
in the frequency domain. I have not been able to accomplish this using the following code. Anyone have any ideas?
clear
k=25;
m=1;
c=1;
wn=sqrt(k/m);
zeta=c/(2*sqrt(k*m));
fstart=-2.3873; %Start frequency
fend=2.3873; %End frequncy
K=16; %Number of points
f=linspace(fstart,fend,K);
w=2*pi.*f;
delta_f=(fend-fstart)/K;
G=1./(m.*(-w.^2+2.*zeta.*wn.*w.*i+wn.^2));
mag=abs(G);
tstart=0;
tend=10;
N=16;
%%%%%%%%%%%%%%%%%%%%
%%%%%Calculations
wn=sqrt(k/m);
zeta=c./(2.*sqrt(k*m))
wd=wn.*sqrt(1-zeta.^2);
delta_t=(tend-tstart)/N;
t=linspace(tstart,tend,N);
%%%%%%%%%%%%%%%%%%%%
%%%%%%Impulse Response of a 1DOF system
x=exp(-zeta.*wn.*t).*sin(wd.*t)./(m.*wd);
plot(t,x)
FRF=fft(x,N).*delta_t;
magexp=abs(FRF);
figure(1)
semilogy(w,magexp)
hold on
semilogy(w,mag,'k')
legend('exp','theoretical')
figure(2)
irf=ifft(G)./delta_f;
plot(real(irf))
hold on
plot(x,'k')





RE: Fourier transform of impulse response
The fft outputs all positive frequencies from zero to fs. You used the output as if the output range was from -fs/2 to fs/2. The MATLAB fftshift takes care of this for you since frequencies from fs/2 to fs are the same as from -fs/2 to zero.
Your sample rate to too low. You are at about the Nyquist for the carrier, when you put on your very heavy exponential decay the frequency splatter is at least double (infinite, but from practical engineering you can can decide how far is far enough).
Here are some changes I made that will make the frequency domain plot look better.
N=160; % Heavily oversample to just show the point
fs = 1 / delta_t;
ws = 2 * pi * [ -fs / 2 : fs / N : ( fs / 2 - fs / N ) ]; % Done this way to show the fft output expectation
figure(1)
semilogy(ws,fftshift( magexp ))
hold on
semilogy(w,mag,'k')
legend('exp','theoretical')
hold off % Don't foprget this when posting! Be kind to us who do this while other work is running!
jsolar