how can i solve this problem

조회 수: 9 (최근 30일)
Bahadir Celiktas
Bahadir Celiktas 2020년 5월 27일
댓글: Bahadir Celiktas 2020년 5월 28일
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
KSSV
KSSV 2020년 5월 27일
Copy paste the code here.....not an image snippet.
madhan ravi
madhan ravi 2020년 5월 28일
Don’t use table as a variable name.

댓글을 달려면 로그인하십시오.

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 5월 28일
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'.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by