close all;
figure
hold on
syms t_o;
d_t=0.01;
x=0;
for t=0:d_t:1
x_d_dot=pi*cos(pi*t/2)/2;
y=-20*x+(pi/2);
f=-(1.5+0.5*sin(t_o))*y^2*cos(3*x);
s=(y-x_d_dot+20*(x-sin(pi*t/2)));
if(s >= 0)
g=1;
else g=-1;
end
u=1.5*(y)^2*cos(3*x)-pi^2*sin(pi*t_o/2)/4-20*(y-x_d_dot)-(0.5*y^2*abs(cos(3*x))+0.1)*g;
% u1=1.5*(y)^2*cos(3*x)-pi^2*sin(pi*t/2)/4-20*(y-x_d_dot)-(0.5*y^2*abs(cos(3*x))+0.1)*g;
x=x+double(int(int(f+u,t_o),t_o,t,t+d_t));
plot(t,u);
end
axis([0 5 -5 6])
在這中想要畫出u的圖形,但在plot(t,u)中卻跑出錯誤Conversion to double from sym is not possible.
請問各位大大這要怎麼解決