You are on page 1of 1

%calcule de la commande en temps minimale

u0=-1;
t0=0;
x10=1;
x20=1;
Z=fsolve(@(Z) utfmin(Z,u0,t0,x10,x20),[1;2])
solution1=[u0;Z];
tc=Z(1)
tf=Z(2)

function
function e=utfmin(Z,t0,x10,u0,x20)
tc=Z(1) ;
tf=Z(2) ;
e(1)=-0.5*u0*(tf-tc)^2+(u0*(tc-t0)+x20)*(tf-tc)+0.5*u0*(tc-t0)^2+x20*(tc-t0)+x10 ;
e(2)=-u0*(tf-tc)+u0*(tc-t0)+x20 ;
end

You might also like