How can I use the function coeffs() as the input to the function tf()?
This code works to give me the root locus of my system, but I have to manually enter the coefficients
num = [1, 117/10, 24477/400, 5584/125, -2315137/40000, 36905889/40000, -66965649/160000, -921912043/80000, 34652192177/640000, -4796713113/25600, 62141795103/160000, -223688325847/320000, 32896376299/40000, -7904756769/10000, 708588777/2000, -52514891/800];
den = [1, -4/5, -5929/400, -14969/2000, 56007543/160000, -550116261/400000, 187999365153/64000000, -1333141873017/320000000, 1759926060179/400000000, -120268082137481/32000000000, 819503408996093/320000000000, -4388359670461129/3200000000000, 338687548373223/640000000000, -1907357941873611/12800000000000, 306186935180877/10240000000000, -4892378756049/1024000000000]
sys = tf(num,den);
rlocus(sys);
However, the following code is not working. I imagine that the output of coeffs() &/or fliplr() is not technically an array despite appearing so when I print the output.
syms s
n = (s^2+10*s+50)*(s^2+8.6*s+21.73)*(s^2-0.7*s+0.1625)*(s^2-2*s+3.25)^2*(s^2+4)^2*(s-2.2);
x = expand(n);
d = (s^2+8.6*s+26.33)*(s^2+0.3*s+0.6625)*(s^2+0.09)*(s^2-0.8*s+0.25)*(s^2-0.9*s+0.5625)*(s^2-2*s+2.69)*(s^2-4*s+4.0225)*(s-2);
y = expand(d);
num = coeffs(x);
num = fliplr(num)
den = coeffs(y);
den = fliplr(den)
sys = tf(num,den); %error line
figure(1)
rlocus(sys)
If someone could help me figure out how to modify the second chunk of code so that the transfer function is created that would be much appreaciated.This code works to give me the root locus of my system, but I have to manually enter the coefficients
num = [1, 117/10, 24477/400, 5584/125, -2315137/40000, 36905889/40000, -66965649/160000, -921912043/80000, 34652192177/640000, -4796713113/25600, 62141795103/160000, -223688325847/320000, 32896376299/40000, -7904756769/10000, 708588777/2000, -52514891/800];
den = [1, -4/5, -5929/400, -14969/2000, 56007543/160000, -550116261/400000, 187999365153/64000000, -1333141873017/320000000, 1759926060179/400000000, -120268082137481/32000000000, 819503408996093/320000000000, -4388359670461129/3200000000000, 338687548373223/640000000000, -1907357941873611/12800000000000, 306186935180877/10240000000000, -4892378756049/1024000000000]
sys = tf(num,den);
rlocus(sys);
However, the following code is not working. I imagine that the output of coeffs() &/or fliplr() is not technically an array despite appearing so when I print the output.
syms s
n = (s^2+10*s+50)*(s^2+8.6*s+21.73)*(s^2-0.7*s+0.1625)*(s^2-2*s+3.25)^2*(s^2+4)^2*(s-2.2);
x = expand(n);
d = (s^2+8.6*s+26.33)*(s^2+0.3*s+0.6625)*(s^2+0.09)*(s^2-0.8*s+0.25)*(s^2-0.9*s+0.5625)*(s^2-2*s+2.69)*(s^2-4*s+4.0225)*(s-2);
y = expand(d);
num = coeffs(x);
num = fliplr(num)
den = coeffs(y);
den = fliplr(den)
sys = tf(num,den); %error line
figure(1)
rlocus(sys)
If someone could help me figure out how to modify the second chunk of code so that the transfer function is created that would be much appreaciated. This code works to give me the root locus of my system, but I have to manually enter the coefficients
num = [1, 117/10, 24477/400, 5584/125, -2315137/40000, 36905889/40000, -66965649/160000, -921912043/80000, 34652192177/640000, -4796713113/25600, 62141795103/160000, -223688325847/320000, 32896376299/40000, -7904756769/10000, 708588777/2000, -52514891/800];
den = [1, -4/5, -5929/400, -14969/2000, 56007543/160000, -550116261/400000, 187999365153/64000000, -1333141873017/320000000, 1759926060179/400000000, -120268082137481/32000000000, 819503408996093/320000000000, -4388359670461129/3200000000000, 338687548373223/640000000000, -1907357941873611/12800000000000, 306186935180877/10240000000000, -4892378756049/1024000000000]
sys = tf(num,den);
rlocus(sys);
However, the following code is not working. I imagine that the output of coeffs() &/or fliplr() is not technically an array despite appearing so when I print the output.
syms s
n = (s^2+10*s+50)*(s^2+8.6*s+21.73)*(s^2-0.7*s+0.1625)*(s^2-2*s+3.25)^2*(s^2+4)^2*(s-2.2);
x = expand(n);
d = (s^2+8.6*s+26.33)*(s^2+0.3*s+0.6625)*(s^2+0.09)*(s^2-0.8*s+0.25)*(s^2-0.9*s+0.5625)*(s^2-2*s+2.69)*(s^2-4*s+4.0225)*(s-2);
y = expand(d);
num = coeffs(x);
num = fliplr(num)
den = coeffs(y);
den = fliplr(den)
sys = tf(num,den); %error line
figure(1)
rlocus(sys)
If someone could help me figure out how to modify the second chunk of code so that the transfer function is created that would be much appreaciated. coeff, tf, coeff(), tf() MATLAB Answers — New Questions