Lyapunov Plotting: using 'mesh' and 'meshgrid' with matricies
17 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Daniel Cleveland
am 4 Apr. 2015
Kommentiert: Intan Utari
am 1 Apr. 2021
I'm trying to plot a 3d graph of a Lyapunov function of a control system I've created. The function is:
V(x)=xT*P*x
where x is a 2x1 matrix of the errors, e and de/dt:
x = [e;ed];
Therefore x transpose is a 1x2 matrix:
xT = [e, ed];
and the P matrix is 2x2 of constants (ie p1=const,p2=const,p3=const,p4=const):
P = [ p1 p2 ; p3 p4];
"e" and "ed" are a 1xn set of data from my simulation thus V ends up being a 1xn matrix
This is my code right now, I don't know what to do from here:
e = ErrorData.signals.values(:,1);
ed = ErrorData.signals.values(:,2);
for i=1:3420
V(i) = [e(i) , ed(i)] * P * [e(i) ; ed(i)] ;
end
I'm trying to plot (x,y,z) = (e,ed,V) in 3 dimensions but I can't seem to be able make my final vector V suitable for plotting in 3d. for e and ed you can use meshgrid, but I can't get V in the proper form.
x=[-4:.04:4];
y=x;
[X,Y]=meshgrid(x,y);
z=X.^2 + Y.^2;
mesh(X,Y,z)
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (2)
Daniel Cleveland
am 4 Apr. 2015
1 Kommentar
Roger Stafford
am 4 Apr. 2015
That result tells me you should be using dots for your plot marker, not lines. You will then see a crude representation of your desired "surface". Your data is not in suitable form to use with 'surf', which requires a mesh form of input.
Roger Stafford
am 4 Apr. 2015
To get the V you need for plot3, do this:
V = sum(x.*(P*x),1);
Don't do a meshgrid on e and ed for use in plot3. You were probably thinking of 'surf', but that kind of surface plotting is not suitable for your particular problem.
1 Kommentar
Intan Utari
am 1 Apr. 2021
Dear Sir How are you? Hope you are well and healthy. I have a model of the spread of diphtheria by vaccination and I achieved the linearization of the model through the lyapunov function constructed using the krasovskii method but actually I don't know how to check the stability of the SIR mathematical model of diphtheria spread by vaccination using the Lyapunov stability theorem in Matlab. Would you, if possible help me in this matter, Please. thank you
Siehe auch
Kategorien
Mehr zu Matrix Computations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!