Code covered by the BSD License  

Highlights from
Dynamical Systems with Applications using MATLAB

image thumbnail

Dynamical Systems with Applications using MATLAB

by

Stephen Lynch (view profile)

 

13 Sep 2002 (Updated )

Companion Software.

Editor's Notes:

This file was selected as MATLAB Central Pick of the Week

Programs_11a.m
% Chapter 11 - Hamiltonian Systems, Lyapunov Functions, and Stability.
% Programs_11a - Surface and Contour Plots. Finding Vdot.
% Copyright Birkhauser 2013. Stephen Lynch.

% The double-well potential (Fig. 11.5(b)).
% Symbolic Math toolbox required.
ezsurfc('-x^2/2+x^4/4+y^2/2',[-1.5,1.5]);

% Calculating Vdot (Exercise 6).
clear
syms x y V
V=(1-4*x^2-y^2)^2;
xdot=-y*(1+x)/2+x*(1-4*x^2-y^2);
ydot=2*x*(1+x)+y*(1-4*x^2-y^2);
Vdot=factor(diff(V,x)*xdot+diff(V,y)*ydot)

% Phase portraits may be plotted using the M-files in Chapter 8.
% End of Programs_11a.

Contact us