MATLAB - deriving frequency response from impulse response

Thread Starter

kdillinger

Joined Jul 26, 2009
141
Hello,

I am trying to write a MATLAB routine that will plot the frequency response of a circuit based on the circuits impulse response.

For starters, I am using a simple RC low pass filter with values of R=1kΩ and C=1μF. The transfer function will be:

(1/RC)/(s+(1/RC)) or 1000/(s+1000).

The commands I am using are:

num=[1000];
den=[1 1000];
Hs=tf(num,den);
ImpRes=impulse(Hs);
MagFFT=abs(fft(ImpRes));
plot(MagFFT);


I am confident up until the plot of the magnitude of the fft. Any ideas?
 

Thread Starter

kdillinger

Joined Jul 26, 2009
141
109 views and no replies. :(

I decided to skip writing my own FFT in MATLAB and use the freqs routine instead.

An FFT will come at a later date. ;)
 

Thread Starter

kdillinger

Joined Jul 26, 2009
141
The problem is I am getting what appears to be incorrect results. I am entering a transfer function; i.e., 1000/(s+1000), getting the impulse response and then taking the FFT of that data. I am expecting the frequency response. More importantly, a frequency response as in gain & phase vs. frequency. But I am having difficulty formatting the results.
 
Top