this code is not working it defied my debug plis assist...
Info
This question is closed. Reopen it to edit or answer.
Show older comments
x0=[1 4];
tspan=[0 10];
[t,x]=ode45('Assignment_6a',tspan,x0);
% figure(1)
% plot(t,x(:,1),'r-',t,x(:,2),'k--');
% xlabel('time, sec');
% ylabel('x1(t) and x2(t)');
% title('Time response');
% hold on
figure(A)
plot(x(:,1),x(:,2));
xlabel('x1');
ylabel('x2');
title('phase portrait');
legend('phase portrait trajectory');
hold on
here is its dynamics.....
function xdot=Assignment_6a(t,x)
a=1;
k=1;
% Defining the sliding mode controller
s=a*x(1)+x(2);
u=10*(-a*x(2)-sign(s)*(2*(x(1)^2+2*abs(x(2)))-k*s));
% Now the system equations
xdot(1)=x(2);
xdot(2)=1.3*x(1)^2+1.5*abs(x(2))+(1.1+sin(x(1)+x(2)))*u;
xdot=xdot';
1;
Answers (0)
This question is closed.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!