MATLAB Answers

How to properly set up my Transfer function

3 views (last 30 days)
syms s
J1 = 0.0024;
C1 = 0.007;
K12 = 2.8;
a = 0;
z = 1;
b = 1;
p = 1;
Kc = .1;
Kh = ((16000)*(1/(2*pi))*(32));
Ka = (10/32768)*2*0.1*3;
Gn = (Kh*Ka)/J1
Gd = s^2 + (C1/J1)*s + K12/J1
Cn = Kc*(a*s+z)
Cd = (b*s+p);
% Cs = Cn/Cd;
num = [Cn * Gn]
dem1 = Cd*Gd
dem2 = Cn * Gn
dem = (dem1 + dem2)
% Tf = num/(dem1 + dem2)
sys = tf(num,dem)
step(10000*sys)

  0 Comments

Sign in to comment.

Accepted Answer

Reshma Nerella
Reshma Nerella on 10 Nov 2020
Hi,
The numerator and denominator coefficients of transfer function should be a row vector or a cell array of row vectors. In the above of code
num = [Cn * Gn]
>> 6835652755764317/10995116277760
class(num)
>> 'sym'
You need to convert 'num' to a vector.
dem = (dem1 + dem2)
>> (s + 1)*(s^2 + (35*s)/12 + 3500/3) + 6835652755764317/10995116277760
class(dem)
>> 'sym'
Convert 'dem' to a vector of polynomial coefficients.
For example,
sys(s)=1/(2s2+3s+4);
Specify the numerator and denominator coefficients ordered in descending powers of s, and create the transfer function model.
numerator = 1;
denominator = [2,3,4];
sys = tf(numerator,denominator)
sys =
1
---------------
2 s^2 + 3 s + 4
%Continuous-time transfer function.
For more information on tf function, refer to the documentation page

  7 Comments

Show 4 older comments
Jorje German
Jorje German on 11 Nov 2020
Thank you for the advise. I do have one more question. How do I go about finding the zeros, poles, and gains. Ive tried doing
rlocus(TF)
and just clicking on the information. Ive also tried
[z,p,k] = zpkdata(TF)
but I cannot access the data.
Paul
Paul on 12 Nov 2020
zpkdata returns z and p in cell arrays; they need to be accessed as such:
>> TF=feedback(sysc*sysg,1)
TF =
621.7
------------------------------
s^3 + 2.817 s^2 + 1166 s + 505
>> [z,p,k]=zpkdata(TF);
>> z{:}
ans =
0×1 empty double column vector
>> p{:}
ans =
-1.1916 +34.1163i
-1.1916 -34.1163i
-0.4334 + 0.0000i
>> k
k =
621.6990
Jorje German
Jorje German on 12 Nov 2020
Thank you very much. You were very hepful

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!