You are on page 1of 2

Plotting Lyapunov Functions Using MATLAB

F.L. Lewis
updated Tuesday, February 04, 2003

Example 1 Quadratic Lyapunov Function


V ( x) = x 2 + y 2
>> x=[-4:.04:4];
>> y=x;
>> [X,Y]=meshgrid(x,y);
>> z=X.^2 + Y.^2;
>> mesh(X,Y,z)

Example 2
Slotine and Li p. 63
V ( x) = (1 - cosq ) + q& 2 / 2
>> x=[-4:.04:4];
>> y=x;
>> [X,Y]=meshgrid(x,y);
>> z=(1-cos(X))+(Y.^2)/2;
>> meshc(X,Y,z)

Example 3
Slotine and Li p. 67
V ( x) = 2(1 - cosq ) + q& 2 / 2 + q& 2 + q 2 / 2

>> x=[-4:.04:4];
>> y=x;
>> [X,Y]=meshgrid(x,y);
>> z=2*(1-cos(X))+(X.^2 + Y.^2)/2 + (Y.^2)/2;
>> meshc(X,Y,z)

You might also like