i am trying to solve a nonholonomic system against a given controller using ode solver but cann't get the right results.
2 次查看(过去 30 天)
显示 更早的评论
the controller is designed using model decomposition.the system has six states.
the mathematics for the controller is sound and all states should go to zero against a given initial condition.for different initial condition the sign of d5 and d6 is altered in the controllers to get convergence.
I have tried all possible scenarios but can't get the convergence.i also need to know if the variable 't' {cos(2*pi*t) and sin(2*pi*t)} in my controller has any thing to do with the problem.
the complete code is as follow
function dx=lbracket(t,x)
dx = zeros(6,1);
% define state variables
T=0.5;
x1 = x(1);
x2 = x(2);
x3 = x(3);
x4 = x(4);
x5 = x(5);
x6 = x(6);
v1=-x1-x2*x3-x4*x5;
v2=-x2;
v3=-x4;
v4=-x6;
v5=x3;
v6=x5;
d5=3.54491*sign(v5)*sqrt(abs(v5)/T);
d6=3.54491*sign(v6)*sqrt(abs(v6)/T);
u1=v1+d5*sin((2*pi*t)/T)-d6*cos((2*pi*t)/T);
u2=v2-d5*cos((2*pi*t)/T);
u3=v3+d6*cos((2*pi*t)/T);
u4=v4;
%
%
dx(1) = u1;
dx(2) = u2;
dx(3) = x(2)*u1;
dx(4) = u3;
dx(5) = x(4)*u1;
dx(6) = u4;
end
% function lbracket called in another m-file
Tspan = [0 50];
IC = [2 2 2 2 2 2];
options = odeset('RelTol',1e-2,'AbsTol',[1e-2 1e-2 1e-2 1e-2 1e-2 1e-2]);
[T,Y] = ode45(@lbracket, Tspan,IC,options);
x1 = Y(:,1);
x2 = Y(:,2);
x3 = Y(:,3);
x4 = Y(:,4);
x5 = Y(:,5);
x6 = Y(:,6);
figure()
plot(T,x1,T,x2,T,x3,T,x4,T,x5,T,x6,'linewidth',2)
legend('x1','x2','x3','x4','x5','x6',6);
xlabel('t(s)')
ylabel('x_1,x_2,x_3,x_4,x_5,x_6')
grid on
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Dynamic System Models 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!