0% found this document useful (0 votes)
17 views8 pages

RAMANE Negativa) Folosind Urmtorul Cod Aratam Functia Lyapunov: (

The document discusses using MATLAB code to graphically represent Lyapunov functions and trajectories over time. Specifically, it contains: 1) Code to plot level sets of a Lyapunov function V and show that its derivative dV is negative within a region, demonstrating stability. 2) Code using ode23 to simulate trajectories over time for different initial conditions, and plot the values of V(t) and E(t) = xTx for each trajectory on the same axes for comparison. 3) The Lyapunov function used is V(t)=xTPx and the total energy is E(t)=xTx, with P being a constant matrix. Six different initial conditions are

Uploaded by

Gabriela Ivan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views8 pages

RAMANE Negativa) Folosind Urmtorul Cod Aratam Functia Lyapunov: (

The document discusses using MATLAB code to graphically represent Lyapunov functions and trajectories over time. Specifically, it contains: 1) Code to plot level sets of a Lyapunov function V and show that its derivative dV is negative within a region, demonstrating stability. 2) Code using ode23 to simulate trajectories over time for different initial conditions, and plot the values of V(t) and E(t) = xTx for each trajectory on the same axes for comparison. 3) The Lyapunov function used is V(t)=xTPx and the total energy is E(t)=xTx, with P being a constant matrix. Six different initial conditions are

Uploaded by

Gabriela Ivan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

TEMA1

-Metoda grafica (domeniul pe care derivata functiei Lyapunov


RAMANE negativa)
Folosind urmtorul cod aratam functia Lyapunov:
(Funcia contour Matlab arat seturile de nivel al Funcia Lyapunov )
[x1,x2]=meshgrid(-60:5:60, -60:5:60)
v=12.*x1.^2+24.*x1.*x2+25.*x2.^2;
subplot(1, 2, 1); mesh(x1,x2,v)
subplot(1, 2, 2); [c, h] = contour(x1,x2,v); clabel(c,h);
colorbar

dac vom folosi urmtorul cod Matlab :


-dV pt x1, x2 apartine [-30; 50]
[x1,x2]=meshgrid(-30:5:50, -30:5:50)
dv=-24.*x1.^2-26.*x2.^2-24.*x1.*x2+(24./53).*x1.*x2.^2+(24./53).*x2.*x1.^2+(24./53).*x2.^3+(24./53).*x1.*x2.^2+(24./47).*x2.*x1.^2+(50./47).*
x1.*x2.^2
subplot(1, 2, 1); mesh(x1,x2,-dv)
subplot(1, 2, 2); [c, h] = contour(x1,x2,-dv); clabel(c,h);
colorbar
(dV<0)

-dV pt x1, x2 apartine [-30; 49]


[x1,x2]=meshgrid(-30:5:49, -30:5:49)
dv=-24.*x1.^2-26.*x2.^2-24.*x1.*x2+(24./53).*x1.*x2.^2+(24./53).*x2.*x1.^2+(24./53).*x2.^3+(24./53).*x1.*x2.^2+(24./47).*x2.*x1.^2+(50./47).*
x1.*x2.^2
subplot(1, 2, 1); mesh(x1,x2,-dv)
subplot(1, 2, 2); [c, h] = contour(x1,x2,-dv);
clabel(c,h);colorbar
(dV>0)

Tema 2 Reprezentati grafic functiile V(t)=xTPx ( plot(t,V(t)) ) si


E(t)=xTx.
-V in timp
[t,x]=ode23('f3',[0,60],
for i=1:length(t)
V=[V x(i,:)*P*x(i,:)'];
end ,plot(t,V,'b'), hold
[t,x]=ode23('f3',[0,60],
for i=1:length(t)
V=[V x(i,:)*P*x(i,:)'];
end ,plot(t,V,'m')
[t,x]=ode23('f3',[0,60],
for i=1:length(t)
V=[V x(i,:)*P*x(i,:)'];
end ,plot(t,V,'r')
[t,x]=ode23('f3',[0,60],
for i=1:length(t)
V=[V x(i,:)*P*x(i,:)'];
end ,plot(t,V,'c')
[t,x]=ode23('f3',[0,60],
for i=1:length(t)
V=[V x(i,:)*P*x(i,:)'];
end ,plot(t,V,'g')
[t,x]=ode23('f3',[0,60],
for i=1:length(t)
V=[V x(i,:)*P*x(i,:)'];
end ,plot(t,V,'k')
[t,x]=ode23('f3',[0,60],
for i=1:length(t)
V=[V x(i,:)*P*x(i,:)'];
end ,plot(t,V,'k')

[70,46.9]),P=[12 12; 12 25]; V=[];


on
[50,53]),P=[12 12; 12 25]; V=[];

[48,47.3]),P=[12 12; 12 25]; V=[];

[47.5,47.9]),P=[12 12; 12 25]; V=[];

[46.5,48.9]),P=[12 12; 12 25]; V=[];

[46,46.9]),P=[12 12; 12 25]; V=[];

[44,45.9]),P=[12 12; 12 25]; V=[];

-E in timp
[t,x]=ode23('f3',[0,60],
for i=1:length(t)
E=[E x(i,:)*x(i,:)'];
end ,plot(t,E,'b'), hold
[t,x]=ode23('f3',[0,60],
for i=1:length(t)
E=[E x(i,:)*x(i,:)'];
end ,plot(t,E,'m')
[t,x]=ode23('f3',[0,60],
for i=1:length(t)
E=[E x(i,:)*x(i,:)'];
end ,plot(t,E,'r')
[t,x]=ode23('f3',[0,60],
for i=1:length(t)
E=[E x(i,:)*x(i,:)'];
end ,plot(t,E,'c')
[t,x]=ode23('f3',[0,60],
for i=1:length(t)
E=[E x(i,:)*x(i,:)'];
end ,plot(t,E,'g')
[t,x]=ode23('f3',[0,60],

[70,46.9]),P=[12 12; 12 25]; E=[];


on
[50,53]),P=[12 12; 12 25]; E=[];

[48,47.3]),P=[12 12; 12 25]; E=[];

[47.5,47.9]),P=[12 12; 12 25]; E=[];

[46.5,48.9]),P=[12 12; 12 25]; E=[];

[46,46.9]),P=[12 12; 12 25]; E=[];

for i=1:length(t)
E=[E x(i,:)*x(i,:)'];
end ,plot(t,E,'k')
[t,x]=ode23('f3',[0,60], [44,45.9]),P=[12 12; 12 25]; E=[];
for i=1:length(t)
E=[E x(i,:)*x(i,:)'];
end ,plot(t,E,'k')

You might also like