tf2zp how to use k value

7 views (last 30 days)
CD
CD on 2 Feb 2019
Commented: CD on 2 Feb 2019
Setup:
2_a Coef and pole/zero pairs and gain (k)
aN = 2.11e-12;
bN = 3.90e-6;
cN = 0;
aD = 1.07e-10;
bD = 2.97e-5;
cD = 1;
num =[aN bN cN];
den =[aD bD cD];
[z,p,k] = tf2zp(num,den)
z =
1.0e+06 *
0
-1.8483
p =
1.0e+05 *
-2.3836
-0.3921
k =
0.0197
ZA = .0197*( s*(1 + s/1848300) / ((1 + s/238360)*(1 + s/39210)));
Ran the following:
R1 = 3000;
R2 = 16000;
R4 = 360;
C2 = 1.3e-9;
C4 = 1.5e-9;
w1 = (1/(C4*R4));
f1 = w1/2*pi;
w2 = (1/(C4*(R4+R1)));
f2 = w2/2*pi;
w3 = (1/(C2*R2));
f3 = w3/2*pi;
s = tf('s');
Z1 = R1*( (1 + s/w1)/(1 + s/w2) );
Z2 = R2*(1 + w3/s);
Z = minreal(Z1/(Z1 + Z2));
ZA = (.0197)*( s*(1 + s/1848300) / ((1 + s/238360)*(1 + s/39210)));
fmin = 10; % minimum frequency = 10 Hz
fmax = 10e6; % 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 = {[-200,200];[-360,360]}; % magnitude and phase axes limits
BodeOptions.Grid = 'on'; % include grid
figure(2);
% define plot title
BodeOptions.Title.String = 'Z1/(Z1+Z2) vs ZA';
bode(Z, BodeOptions, 'b', ZA, BodeOptions, 'r'); % generate the magnitude and phase responses
legend('Z1/(Z1+Z2)', 'ZA')
And my gain from ZA does not match Z1/(Z1 + Z2).
If I modify to this:
ZA = 20log(.0197)*( s*(1 + s/1848300) / ((1 + s/238360)*(1 + s/39210)));
then ZA phase is mesed up.
How does one deal with k?

Answers (1)

KALYAN ACHARJYA
KALYAN ACHARJYA on 2 Feb 2019
Edited: KALYAN ACHARJYA on 2 Feb 2019
tf2zp how to use k value
When the code exucate the following line
[z,p,k] = tf2zp(num,den);
here k represents the gain of the transfer functuion. The k value avalible in current variable list (workspace), just use the variable k in your code when it required after the tf2zp line.
  1 Comment
CD
CD on 2 Feb 2019
So I took the results from tf2zp:
ZA = .0197*( s*(1 + s/1851900) / ((1 + s/238970)*(1 + s/39130)));
and fed it into the bode function and the phase is perfect and the shape of the magnitude is perfect though the gain of the magnitude is off.
Trying to figure out where the problem is.

Sign in to comment.

Tags

Community Treasure Hunt

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

Start Hunting!