Matlab bode plot with specific cut off frequency
Show older comments
This scrip displays a bode diagram however the cut off frequency is incorrect. I need the cut off frequency to be 15kHz whilst showing the gain to be 27dB. Does anyone have an idea how I can achieve this? Thank in advance.
clc
format long
C1 = 0.000000000150;
C2 = 0.000000000470;
R1 = 10000;
R2 = 180000;
R3 = 2700;
R4 = 56000;
G = (R3+R4)/R3;
A = 1/(C1*R2)
B = 1/(C2*R2)
C = (1/(C1*R1))*(1-G)
D = 1/(C1*C2*R1*R2)
E = (A+B+C)
%{
Numerator = {[G 0 0] };
Denominator = {[1 0] [A] [B] [C] [0 D]};
T = tf(Numerator, Denominator)
Numerator = {[G 0 0] };
Denominator = {[1 (A+B+C) D]};
T = tf(Numerator, Denominator)
%}
%{
T = tf([G 0 0], [1 (A+B+C) D]);
%}
%T = tf([21.740 0 0], [1 1.418439716*10^4 5.263157895*10^-6]);
T = tf([G 0 0], [1 E D]);
%T = tf([21.740740740741 0 0], [1 -13778303.125821 7880220646.1781])
options = bodeoptions;
options.FreqUnits = 'Hz'; % or 'rad/second', 'rpm', etc.
bode(T,options);
grid on
Im looking to achieve something like this.

Answers (1)
The easiest option may be to define the radian frequency function:
w = linspace(0, 1.5E+4, 1E+3)*2*pi;
and then supply it as an argument to bode —
clc
format long
C1 = 0.000000000150;
C2 = 0.000000000470;
R1 = 10000;
R2 = 180000;
R3 = 2700;
R4 = 56000;
G = (R3+R4)/R3;
A = 1/(C1*R2);
B = 1/(C2*R2);
C = (1/(C1*R1))*(1-G);
D = 1/(C1*C2*R1*R2);
E = (A+B+C);
%{
Numerator = {[G 0 0] };
Denominator = {[1 0] [A] [B] [C] [0 D]};
T = tf(Numerator, Denominator)
Numerator = {[G 0 0] };
Denominator = {[1 (A+B+C) D]};
T = tf(Numerator, Denominator)
%}
%{
T = tf([G 0 0], [1 (A+B+C) D]);
%}
%T = tf([21.740 0 0], [1 1.418439716*10^4 5.263157895*10^-6]);
T = tf([G 0 0], [1 E D]);
%T = tf([21.740740740741 0 0], [1 -13778303.125821 7880220646.1781])
w = linspace(0, 1.5E+4, 1E+3)*2*pi;
options = bodeoptions;
options.FreqUnits = 'Hz'; % or 'rad/second', 'rpm', etc.
bode(T,w,options);
grid on
.
2 Comments
Aaron Frost
on 21 Feb 2023
Try something like this —
% clc
format long
C1 = 0.000000000150;
C2 = 0.000000000470;
R1 = 10000;
R2 = 180000;
R3 = 2700;
R4 = 56000;
G = (R3+R4)/R3;
A = 1/(C1*R2);
B = 1/(C2*R2);
C = (1/(C1*R1))*(1-G);
D = 1/(C1*C2*R1*R2);
E = (A+B+C);
%{
Numerator = {[G 0 0] };
Denominator = {[1 0] [A] [B] [C] [0 D]};
T = tf(Numerator, Denominator)
Numerator = {[G 0 0] };
Denominator = {[1 (A+B+C) D]};
T = tf(Numerator, Denominator)
%}
%{
T = tf([G 0 0], [1 (A+B+C) D]);
%}
%T = tf([21.740 0 0], [1 1.418439716*10^4 5.263157895*10^-6]);
T = tf([G 0 0], [1 E D]);
%T = tf([21.740740740741 0 0], [1 -13778303.125821 7880220646.1781])
w = logspace(-3, log10(1.5E+8), 1E+3)*2*pi;
options = bodeoptions;
options.FreqUnits = 'Hz'; % or 'rad/second', 'rpm', etc.
bode(T,w,options);
grid on
Fx = gcf;
Kids = Fx.Children;
MagPlot = Kids(3);
YdB = MagPlot.YLim
Ymag = db2mag(YdB)
.
Categories
Find more on Get Started with Control System Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

