nonlinear H-infinity control
3 views (last 30 days)
Show older comments
%the closed-loop system response W=[-0.0367; -0.0327; -0.0333; -0.0762; 0.0883; -0.0093; 503.0411; -9.4101; -45.3581; 0.0006];
x0=[-300 300 5000]'; X(:,1)=x0; h=x2^2/x3; T(1)=0; tf=1; delta_t=0.01; N_t=round(tf/delta_t)+1; r(1)=0; u(1)=0; sum_z=delta_t*((h'*h)+u(1)'*u(1)); w=[70*sin(0); 70*sin(pi/4); 70*cos(0)]; sum_w=delta_t*(w'*w); i=0; for i=2:N_t; x1=X(1,i-1);x2=X(2,i-1); x3=X(3,i-1); f=[x2^2/x3;-x1*x2/x3;x1]; g1=[0;1;0]; g2=[0;-1;0]; DBF= [ 2*x1 0 0 x2 x1 0 x3 0 x1 0 2*x2 0 0 x3 x2 0 0 2*x3 1/x3 0 -x1/x3^2 x2/x3 x1/x3 -x1*x2/x3^2 0 2*x2/x3 -x2^2/x3^2 0 4*x2^3/x3^2 -2*x2^4/x3^3]; uu=-0.5*g2'*DBF'*W; t=delta_t * (i-1); w=[70*sin(0.5*t); 70*sin(0.5*t+pi/4); 70*cos(0.5*t)];
X(:,i)=X(:,i-1)+delta_t*(f+g2*uu+g1'*w);
T(i)=t;
u(i)=uu;
sum_z=sum_z+delta_t*(h'*h+u(i)'*u(i));
sum_w=sum_w+delta_t*(w'*w);
r(i)=sum_z/sum_w;
end
% system states
figure(6)
plot(T,X(1,:),'-',T,X(2,:),'-.',T,X(3,:),'-*');
legend('x_1','x_2','x_3');
%control of the system
figure (7)
plot(T,u,'-');
legend('u');
% gamma with t
figure(8)
plot(T,r,'-');
legend('r_1');
i have the above code for my nonlinear system, when i run it i get wrong results,will appreciate any help
0 Comments
Answers (0)
See Also
Categories
Find more on Dynamic System Models in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!