What is the difference between them?

These code are right:
a=0.336;
Ta=9.476;
Te=1.208;
Tw=1.498;
eqh=[0.661;0.619;0.568];
ex=[-1.24;-1.346;-1.441];
en=-ex;
ey=[0.376;0.705;0.968];
eqx=[-0.309;-0.357;-0.392];
eh=[1.594;1.583;1.545];
eyqh=[0.642;0.78;0.897];
a0=a*Ta*Te^2;
syms bt Td Ki Kp;
a1=[];a2=[];a3=[];a4=[];exqh=[];
for i=1:3
Kp=1/bt;
exqh(i)=en(i)*eqh(i)+eqx(i)*eh(i);
Ki=1/(bt*Td);
a1=Ta*Tw*eqh(i)+a*Te^2*en(i)+a*Te^2*ey(i)*Kp
a1(i)=a1
end
But these code are wrong:
a=0.336;
Ta=9.476;
Te=1.208;
Tw=1.498;
eqh=[0.661;0.619;0.568];
ex=[-1.24;-1.346;-1.441];
en=-ex;
ey=[0.376;0.705;0.968];
eqx=[-0.309;-0.357;-0.392];
eh=[1.594;1.583;1.545];
eyqh=[0.642;0.78;0.897];
a0=a*Ta*Te^2;
syms bt Td Ki Kp;
a1=[];a2=[];a3=[];a4=[];exqh=[];
for i=1:3
Kp=1/bt;
exqh(i)=en(i)*eqh(i)+eqx(i)*eh(i);
Ki=1/(bt*Td);
a1(i)=Ta*Tw*eqh(i)+a*Te^2*en(i)+a*Te^2*ey(i)*Kp
end
The difference between them is
a1=Ta*Tw*eqh(i)+a*Te^2*en(i)+a*Te^2*ey(i)*Kp
a1(i)=a1
and
a1(i)=Ta*Tw*eqh(i)+a*Te^2*en(i)+a*Te^2*ey(i)*Kp

回答(0 个)

类别

帮助中心File Exchange 中查找有关 Get Started with MATLAB 的更多信息

产品

版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by