Continue to Site

# Impulse response function to RC values

Status
Not open for further replies.

#### mskh744

##### Newbie level 5
Hello everyone,

I have a circuit that produce an impulse response function of an RC filter, it looks like this:

Theoretically, the impulse response in time domain is equivalent to the transfer function in the frequency domain. I have two vectors 'x' and 'y' imported from the circuit simulator where x is a time axis and y is the impulse response function of the filter.

I need to evaluate this response and see how accurate it is in describing the filter poles and zeros. The purpose is measuring the impedance of this filter by cross correlating a white noise stimulus with its response. The cross correlation function (CCF) is supposed to be identical to the impulse response and hence if analyzed I can quantify this filter ch's.

How can I get the exact (or very close approximation) value of total parallel R and C of the filter from this curve so I compare it to my filter values and evaluate this process?

I tried getting the fft of the impulse response and plotting the real and imaginary vs frequency but I get curves that I don't understand. Here's the Matlab code I wrote to generate the following plots.

Code:
x=x-0.0397;      %shift for x axis (I neglect the first CC cycle as the system wouldn't have reached steady state yet)
yy1 = smooth(x,y,0.03,'loess'); % smoothing the curve to get better readability later. I'm aware this affects the total realized impedance.

figure
plot(x,y,x,yy1,'--')
legend('CCF','filtered CCF')
xlabel('time')
ylabel('V')

n=length(yy1);

z=fft(yy1)/n;

fs=10e3;
f=fs/2*linspace(0,1,n/2+1);

z=z(1:n/2+1);

R=real(z);
i=imag(z);
mag=abs(z);
phase=angle(z);
figure
plot(R,i)
ylabel('Imaginary');
xlabel('Real')
legend('Nyquist plot')
figure
subplot(2,1,1)
semilogx(f,mag)
legend('Magnitude')
xlabel('f')
ylabel('mag')
subplot(2,1,2)
semilogx(f,phase)
legend('Phase')
xlabel('f')
ylabel('degree')

The 3 plots generated looks like this :

I can't decode any information from these curves about the RC filter. The filter I used to generate that CCF has a total parallel R of 50KOhm and total parallel C of 300pF. Any chance of retrieving that information? maybe I'm missing some normalization factor somewhere. The Nyquist plot doesn't make any sense to me as well as the mag and phase curves. I would appreciate your help to solve this issue.

Hi,

Looks like some artefacts.

I´m not a specialist in this: Just a guess.

Maybe it´s a timing problem.

50kOhms x 300pF cause a tau of 15us
but if fs = 10000, then the fs may bee too low. (time = 100us)

Either choose a higher fs or a higher tau.

Klaus

mskh744

### mskh744

Points: 2
Hi Klaus,

Changing the 'fs' of 100e3 in the code just changes the scale of the frequency axis. Or did you mean the fft sampling rate? (which I don't know how to configure)

How can I get the exact (or very close approximation) value of total parallel R and C of the filter from this curve so I compare it to my filter values and evaluate this process?
I would first think about taking the shift average of neighbor samples in order to at least reduce the amplitude of the artifacts - not sure of the suited amount of the samples to be computed - and then for the second step, you should create your own model for the desired function [ie. y=a/(x+b)] and make use of the fitting methods used for making regression of functions from their samples: https://la.mathworks.com/help/curvefit/custom-nonlinear-models.html

mskh744

### mskh744

Points: 2
As a baseline how about you model a simulated RC and feed your code that impulse response. That should vet out your math, FFT parameters etc.

For example I set out to do this in matlab once and ended up surprised at the number of samples and sample time that was needed to recreate a suitably useful FFT bode plot from an impulse response. For a period of time I thought I was doing things wrong until I realized I had that simple problem.

mskh744

Points: 2