MATLAB Answers

how to plot constant gain with bode

37 views (last 30 days)
Craig Dekker
Craig Dekker on 29 Jan 2019
Answered: Birdman on 30 Jan 2019
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);

  0 Comments

Sign in to comment.

Accepted Answer

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

  0 Comments

Sign in to comment.

More Answers (0)


Translated by