# LC Filter in Matlab

1. Aug 25, 2014

### roam

1. The problem statement, all variables and given/known data

I'm trying to make a theoretical Bode Amplitude plot of the following circuit in Matlab:

The transfer functions is given by

$T=\frac{V_{out}}{V_{in}}=\frac{R_2}{R_2+z_p}$

$z_p=R_p|| j \omega L || \frac{1}{j \omega C} = \frac{R_p}{1+ j R_p (\omega C - \frac{1}{\omega L})}$

Where $R_p$ is the parallel loss resistance of the inductor (~19.49 Ω). R2=300, C=22.09 nF, L=10.08 mH.

I know that the graph is supposed to look like a notch (trap) filter, here is an experimental graph of this same filter:

3. The attempt at a solution

Here is the code I used to make a theoretical plot:

But my plot looks like this:

And after the 103 point it's completely flat.

What is wrong with my code?

Any help is appreciated.

2. Aug 25, 2014

### Staff: Mentor

19.49Ω seems a disastrously low parallel resistance equivalent. I think it will wreak havoc on a filter's response. Are you sure that isn't meant to be a series resistance of 19.49Ω?

I can't comment on matlab.

Last edited: Aug 25, 2014
3. Aug 25, 2014

### milesyoung

I think you forgot an 's' in there. It should be:
Code (Text):

z=Rp/(1+(Rp*s*C)+(Rp/(s*L)));

But I doubt it makes any difference. Like NascentOxygen wrote, that RLC circuit will be extremely lossy, i.e. its Q factor will be very low/bandwidth will be very high.

4. Aug 25, 2014

### Staff: Mentor

Judging by the "experimental graph of this same filter", Rp is likely closer to 20 kΩ than 20 Ω.

5. Aug 26, 2014

### roam

Thank you so much for the feedback.

Yes, I think 19.49 Ω may be the series resistance of the inductor (I measured it using an RCL meter, I will double check this).

But according to my book the parallel resistance Rp may be calculated from the graph using the quality factor relationships:

$Q_p = \frac{R_p}{\omega_0 L}=\omega_0 R_p C$

$Q= Q_p \sqrt{1-2|T_{min}|^2}$

Qp being the quality factor of the parallel inductor-capacitor combination, and Q is the actual quality factor of the filter (a measure of the sharpness of the peak).

|Tmin| is the minimum value of the transfer function (minimum value of |T|), which occurs when |zp| is a maximum (at resonant frequency $\omega_0 =1/\sqrt{LC}$).

In my plot Tmin is my last data point where it is equal to -0.080 dB (or 1.01 in linear magnitude), so

$1.01 = \frac{V_{out}}{V_{in}}= \frac{300}{300+z_p} \implies z_p = -2.97$

zp and Rp are related by:

$z_p=\frac{R_p}{1+jR_p(\omega C - \frac{1}{\omega L})}$

But then how do I solve for $R_p$ from this impedance? How can I get rid of the j's in the denominator? (I'm looking for a way to solve for Rp without actually having to measure it experimentally).

Yes, when I vary the resistance to to Rp≈1 kΩ, the theoretical graph starts to look right.

Last edited: Aug 26, 2014