Matlab bode plot with specific cut off frequency

23 vues (au cours des 30 derniers jours)
Aaron Frost
Aaron Frost le 21 Fév 2023
Commenté : Star Strider le 21 Fév 2023
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.

Réponses (1)

Star Strider
Star Strider le 21 Fév 2023
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 commentaires
Aaron Frost
Aaron Frost le 21 Fév 2023
Sorry I forgot to mention that I need to gain to be visible showing 27dB
This is what im looking to achieve but it needs to be with matlab
Star Strider
Star Strider le 21 Fév 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
YdB = 1×2
-3.000000000000000 0.267445587351631
Ymag = db2mag(YdB)
Ymag = 1×2
0.000000000000001 21.738418068660366
.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Mathematics dans Help Center et File Exchange

Produits


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by