# how to plot constant gain with bode

37 ビュー (過去 30 日間)
Craig Dekker 2019 年 1 月 29 日

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
Error in bode (line 107)
sys = tf(a,b);

### 採用された回答

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);