M-file for calculating frequency response from impulse response

  • Follow


Hello,

I am trying to calculate the magnitude of the frequency response by taking the FFT of an RC circuit's impulse response.  I can obtain and plot the step and impulse response with ease, but I am having difficulty with the plot format for the magnitude of the FFTed impulse response.  
Can someone offer a few tips?


%A simple low pass RC circuit
%R = 1k, C= 1uF
num=[1000];
den=[1 1000];
Hs=tf(num,den);
t=0:0.0001:0.01 % Start at T=0, .001 steps, stop time 0.01
figure(1);
clf;
subplot(2,1,1);
step(Hs,t);
grid;
subplot(2,1,2);
impulse(Hs,t);
figure(2);
clf;
FFTMag=(abs(fft(impulse(Hs,t))));
x=logspace(-100,100,100);
loglog(x,20*log(FFTMag));
xlabel('Frequency ');
ylabel('|H(w)| ');
title('Magnitude Spectrum of Impulse Response');
0
Reply Wayne 12/7/2009 12:43:04 AM


0 Replies
426 Views

(page loaded in 0.019 seconds)

Similiar Articles:













7/24/2012 7:18:54 PM


Reply: