Electronic – Plot RLC band-pass filter using MATLAB

passive-filter

I tried to plot the magnitude of transfer function using Matlab.

\$
H(\omega) = \frac{V_0}{V_i} = \frac{R}{R + j\omega L + 1/j\omega C} = \frac{R}{R + j(\omega L – 1/\omega C)}
\$

schematic

simulate this circuit – Schematic created using CircuitLab

Matlab code:

%% Band-pass filter

R = 1;
C = 1;
L = .02;
w = 0:.01:10;
H = R ./ (R + 1i*(w * L - 1./(w * C)));
mag = abs(H);


% plot magnitude
figure(3), clf
plot(w, mag);
title('Frequency response of RLC series resonent circuit')
xlabel('\omega'), ylabel('|H(\omega)|')
hold on
% plot center frequency
w_center = 1 / sqrt(L*C); 
plot([w_center w_center], get(gca, 'ylim'), 'r--')
plot(get(gca, 'xlim'), [.7071 .7071], 'r--')

How do I choose the value of R, L and C that can plot the actual curve below as same as possible.

enter image description here

Best Answer

You could use the Laplace transform, and the 'bode' command in Matlab:

\$G(s)=\frac{RCs}{s^2LC+sCR+R}\$

Then in Matlab, immediate mode, and using the component values given in the OP: :

num=[1 0];

den=[0.02 1 1];

g=tf(num, den);

bode(g)

Related Topic