how can i solve this problem
Show older comments
syms z kd kp ki a b c;
gs=tf([1369 74],[369600 51080 400 0])
gz=c2d(gs,3,'zoh')
gzz=(0.0004566*z^2+5.817e-06*z-0.0004382)/(z^3-2.933*z^2+2.866*z-0.9332);
f=(kp*(z-kd)*(z-ki))/(z*(z-1));
tzz=gzz*f/(1+gzz*f);
[n,d]=numden(tzz);
d=coeffs(d,z,'all');
d=d/d(1);
pd=(z^2+0.69*z+0.754)*(z^3+a*z^2+b*z+c)
pd=coeffs(pd,z,'all');
prob=pd==d;
sol=solve(prob,[kd ki a b c])
kiv=sol.ki(1);
kdv=sol.kd(1);
av=sol.a(1);
bv=sol.b(1);
cv=sol.c(1);
kpval=0:0.1:600
table=zeros(length(kpval));
for i=1:length(kpval)
table(i,1)=kpval(i);
table(i,2)=double(subs(kiv,kp,kpval(i)));
table(i,3)=double(subs(kdv,kp,kpval(i)));
table(i,4)=double(subs(av,kp,kpval(i)));
table(i,5)=double(subs(bv,kp,kpval(i)));
table(i,6)=double(subs(cv,kp,kpval(i)));
Dz=tf([table(i,1) -table(i,1)*(table(i,3)+table(i,2)) table(i,1)*table(i,2)*table(i,3)],[1 -1 0],3)
Tz=feedback(Dz*Gz,1)
info=stepinfo(Tz)
tablo(i,7)=info.Overshoot;
tablo(i,8)=info.SettlingTime;
end
%%%
Error using symengine
Division by zero.
Error in sym/subs>mupadsubs (line 160)
G = mupadmex('symobj::fullsubs',F.s,X2,Y2);
Error in sym/subs (line 145)
G = mupadsubs(F,X,Y);
Error in Untitled7 (line 23)
table(i,2)=double(subs(kiv,kp,kpval(i)));
2 Comments
KSSV
on 27 May 2020
Copy paste the code here.....not an image snippet.
madhan ravi
on 28 May 2020
Don’t use table as a variable name.
Accepted Answer
More Answers (0)
Categories
Find more on Symbolic Math Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!