how can i solve this problem

2 visualizzazioni (ultimi 30 giorni)
Bahadir Celiktas
Bahadir Celiktas il 27 Mag 2020
Commentato: Bahadir Celiktas il 28 Mag 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 Commenti
KSSV
KSSV il 27 Mag 2020
Copy paste the code here.....not an image snippet.
madhan ravi
madhan ravi il 28 Mag 2020
Don’t use table as a variable name.

Accedi per commentare.

Risposta accettata

Ameer Hamza
Ameer Hamza il 28 Mag 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'.

Più risposte (0)

Categorie

Scopri di più su Symbolic Math Toolbox in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by