Home > Back-end >  For time-varying time-delay systems in matlab input u and state variable x curve along with the chan
For time-varying time-delay systems in matlab input u and state variable x curve along with the chan

Time:10-17

Topic request is as follows:

I try to use the MATLAB programming, my program will be divided into five parts, the code (attached)
Behind part 1: defines some constants or matrix is used, A, B, C, D represents the system state space expression of the parameter matrix,
Part 2: to solve the parameters of gama cycle judgment structure
Part 3: the gama solving matrix P
Part 4: system, control law, drawing
Part 5: define circulation judgment is used in the structure as a function of V

my level is very limited, the code can't run, really do not know how to change, turn to everyone a great god, and in addition, if can be realized by using Simulink and please give some advice, thank you very much great god!
 clear 
CLC
% to define some constants and constant matrix
A=[1 0 0 0 0; 1 0 0 0 0; 0 0 0 0 0. 0 0 0 0 1; 0 0 0 0 0];
B=[0, 2, 0 and 1; 2; 1 0 0, 0, 1].
C=[1 0 0 0 0; 1 0 0 0 0; 1 0 0 0 0; 1 0 0 0 0; 0 0 0 0, 1].
D=(0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
X=(1, 0, 1, 2, 2];
% define the function to solve gama
Eta=1.2;
Rou1=0.3;
Rou2=2;
Ts=0;
De=1;
Gama=0.3;
T=0;
While t<=60
[t, fval]=fminbnd (def_V, t - 6. * De t - 4. * De);
Vmax1=fval;
[t, fval]=fminbnd (def_V, t - 4. * De t - 2. * De);
Vmax2=fval;
[t, fval]=fminbnd (def_V, t - 2. * De, t);
Vmax3=fval;
If t - ts<* De
=6.Gama=gama;
De=De;
Elseif ismember (((t - ts)/De - 6)/2, N)==0
Gama=gama;
De=De;
Elseif Vmax2 & lt;=Vmax1 & amp; & Vmax3 & lt;=(Vmax1. * (Max (1/(eta), (exp (- gama. 2 * * De)))))
Gama=rou1. * gama;
De=rou2. * De;
The else
Gama=gama;
De=De;
End
% to define matrix P
M=[gama.^5 2.*(gama.^4) gama.^3 gama.^5 2.*(gama.^4).*(1-gama);2.*(gama^4) 9.*(gama.^3) 7.*(gama.^2) (2.*gama-10).*(gama.^3) (gama.^2).*(9.*gama-4.*(gama.^2)-10);gama.^3 7.*(gama.^2) 11.*gama (gama-10).*(gama.^2) gama.*(7.*gama-2.*(gama.^2)-20);gama.^5 (2.*gama-10).*(gama.^3) (gama-10).*gama.^2 (gama.^2+25).*(gama.^3) (2.*(gama.^2)+10-2.*(gama.^3)-10.*gama).*(gama.^2);2.*(1-gama).*(gama.^4) (9.*gama-4.*(gama.^2)-10).*(gama.^2) (7.*gama-2.*(gama.^2)-20).*gama (2.*(gama.^2)+25-2.*(gama.^3)-10.*gama).*(gama.^2) (9.*(gama.^2)-8.*(gama.^3)+4.*(gama^4)+50-20.*gama).*gama];
P=1/5. * M;

% to define the state - a place of linear time delay system
BT=B ';
BP=- BT * P;
Sys=delayss (A, B, C, D, delayt);
Delayt=2. * (sin (8. * t)) ^ 2;
U=B * * x P;
[y, t, x]=lsim (sys, u, t, x);
The plot (t, x)
The plot (t, u)
T=t + 0.01;
End
The function V=def_V (x)
V=- x. '* * x P;
End
  • Related