how to plot constant gain with bode

20 次查看(过去 30 天)
How does one plot a constant gain with bode?
The following example gives me the following error:
R1 = 81800;
R2 = 18200;
R3 = 5600;
C1 = 13e-9;
RTH = (R1*R2)/(R1 + R2);
gmmin = 100e-6;
gmmax = 1e-3;
w1 = (1/(C1*R3)); % f1 and f2 from G
f1 = w1/2*pi;
w2 = (1/(C1*R1));
f2 = w2/2*pi;
w3 = (1/(C1*RTH)); % f3 and f4 from T
f3 = w3/2*pi;
w4 = (1/(C1*(RTH+R3)));
f4 = w4/2*pi;
>> Go = R2/(R1 + R2);
>> fmin = 10; % minimum frequency = 10 Hz
fmax = 100e6; % maximum frequency = 10 MHz
% Set Bode plot options
BodeOptions = bodeoptions;
BodeOptions.FreqUnits = 'Hz'; % we prefer Hz, not rad/s
BodeOptions.Xlim = [fmin fmax]; % frequency-axis limits
BodeOptions.Ylim = {[-100,100];[-180,180]}; % magnitude and phase axes limits
BodeOptions.Grid = 'on'; % include grid
figure(2);
% define plot title
BodeOptions.Title.String = 'Go';
bode(Go, BodeOptions, 'b'); % generate the magnitude and phase responses
legend('Go')
Error using tf (line 299)
The values of the "Numerator" and "Denominator" properties must be row vectors or cell arrays of row
vectors, where each vector is nonempty and containing numeric data. Type "help tf.num" or "help tf.den" for
more information.
Error in bode (line 107)
sys = tf(a,b);

采纳的回答

Birdman
Birdman 2019-1-30
To plot Bode of constant, define it as a transfer function but in the following way:
Gs=tf(R1/(R1+R2),1);
bode(Gs);

更多回答(1 个)

Avirup
Avirup 2023-3-22
h1=((1/(s*Cf1)*(Rf1+(1/(s*Cb1))))/((1/s*Cf1)+Rf1+(1/(s*Cb1))));
H=h1/((s*Lf1)+h1);
Re=(2*L)/((D^2)*1/fs)
zn=tf(-Re,1);%Re is simply a dc gain
zd=tf(Re,1);%Re is simply a dc gain
BodeOptions=bodeoptions('cstprefs');
BodeOptions.Grid='on';
BodeOptions.XLim=[10,500000];
BodeOptions.Ylim = {[-100,30];[-180,180]};
BodeOptions.FreqUnits='Hz';
BodeOptions.Title.String='Zn Zd Zout Plot';
bode(zout, zn, zd, BodeOptions)%this gives the bode of Dc gain, zn, zd are dc gains

类别

Help CenterFile Exchange 中查找有关 Get Started with Control System Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by