下列程序段调不通,哪位大虾帮忙调通,谢谢!!!
function [Un,y1,E1,edao1]=Ufun(in,Kp,K,k,tao,T1,T2)
syms t;
t1=0.1:0.1:10
Un=zeros(100,1);
E1=zeros(100,1);
y1=zeros(100,1);
edao1=zeros(100,1);
Un(1)=Kp;
G=K*(exp(-(t-tao)/T1)-exp(-(t-tao)/T2))/(T1-T2)
y1(1)=0;
E1(1)=1;
edao1(1)=-0.001
for i=1:99
e=in-Un(i)*G
edao=diff(e,t);
e1=subs(e,t,t1(i));
edao1(i+1)=subs(edao,t,t1(i));
if (abs(e1)>0)&(edao1(i)*edao1(i+1)<=0)
% if (abs(e1)>0)&(edao1(i+1)==0)
E1(i+1)=e1;
else
E1(i+1)=0
end
if (e1*edao1(i+1)>0)|((abs(e1)>0)&(edao1(i)*edao1(i+1)<=0))
% if (e1*edao1(i+1)>0)|((abs(e1)>0)&(edao1(i+1)==0))
Un(i+1)=Un(i)+Kp*e1;
else %if(e1*edao1(i+1)<0)|(e1==0)
Un(i+1)=k*Kp*sum(E1);
end
y=Un(i+1)*G;
y1(i+1)=subs(y,t,t1(i))
%end
end
end
% [Un,y1,E1,edao1]=Ufun(4,2,0.99,0.05,4,0.4)