Clear Filters
Clear Filters

Plotting the bode plot of a high pass filter using matlab

6 views (last 30 days)
I am trying to theoretically find the frequency response of the circuit given below:
Firstly i found the impedance value of the RC Ladder by applying the equation below, then i defined this as "Z" in my MatLab Code.
Afterwards i wrote a matlab code to plot the filter's frequency response. Matlab Code is given below, the required nominal values shown in the schematic are defined in the code.
f = logspace(0, 5, 1000);
w=2*pi.*f;
s=1i.*w;
Ro=11960e3;
R1=2.17e3;
R2=118.44e3;
R3=496.82e3;
R4=1220e3;
R5=2530e3;
C1=536.29e-12;
C2=217.23e-12;
C3=201.41e-12;
C4=263.35e-12;
C5=556.27e-12;
Rload=200e3;
Z=((1/Ro)+(R1+(1./(s*C1)))+(R2+(1./(s*C2)))+(R3+(1./(s*C3)))+(R4+(1./(s*C4)))+(R5+(1./(s*C5)))).^-1;
H=abs(Rload./(Z+Rload));
semilogx(f, 20*log10(H))
The LTSpice plot (expected one) is like this:
My Matlab Plot is like this:
My mathematical approach seems correct to me let me know if i have anything missing on that part. I am unsure about the code, please let me know if there is something missing in code or my mathematical approach.

Answers (1)

Star Strider
Star Strider on 13 May 2024
The ‘H’ calculation may be reversed. (I can’t read the axis values on the LTSpice plot image.)
Perhaps this —
f = logspace(0, 5, 1000);
w=2*pi.*f;
s=1i.*w;
Ro=11960e3;
R1=2.17e3;
R2=118.44e3;
R3=496.82e3;
R4=1220e3;
R5=2530e3;
C1=536.29e-12;
C2=217.23e-12;
C3=201.41e-12;
C4=263.35e-12;
C5=556.27e-12;
Rload=200e3;
Z=((1/Ro)+(R1+(1./(s*C1)))+(R2+(1./(s*C2)))+(R3+(1./(s*C3)))+(R4+(1./(s*C4)))+(R5+(1./(s*C5)))).^-1;
H=abs(Z./(Z+Rload));
semilogx(f, 20*log10(H))
.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!