how can i solve this problem
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Bahadir Celiktas
le 27 Mai 2020
Commenté : Bahadir Celiktas
le 28 Mai 2020
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 commentaires
Réponse acceptée
Ameer Hamza
le 28 Mai 2020
In the expressions of kiv and kdv, there is kp in the denominator. So, you should start the list of Kp from a non-zero value, for example, change the line to
kpval=0.1:0.1:600 % start from 0.1
also, there appear to be another issue on the line
Tz=feedback(Dz*Gz,1)
Gz is not defined in your code. I guess it should be 'gz'.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Symbolic Math Toolbox dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!