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

### M-file for calculating frequency response from impulse response

• Email
• 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

See related articles to this posting

0 Replies
500 Views

Similar Articles

12/2/2013 6:45:36 AM
page loaded in 455613 ms. (0)