how to plot constant gain with bode

조회 수: 20 (최근 30일)
CD
CD 2019년 1월 29일
답변: Avirup 2023년 3월 22일
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
hayato tsujii
hayato tsujii 2022년 9월 15일
what if theres a constant out in the front

댓글을 달려면 로그인하십시오.

추가 답변 (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