Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
41 views1 page

Phase How To

This document contains a 3-sentence summary of the provided document: The document discusses using Matlab to draw phase portraits by breaking it up into small pieces using the quiver command, providing an example of code to plot the phase portrait for the system x ̇1 = −x1 − 2x2 x21 + x2 , x ̇2 = −x1 − x2 over the region −0.5 ≤ x1 ≤ 0.5, −0.5 ≤ x2 ≤ 0.5, with the resulting figure shown.

Uploaded by

abdallah hosin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views1 page

Phase How To

This document contains a 3-sentence summary of the provided document: The document discusses using Matlab to draw phase portraits by breaking it up into small pieces using the quiver command, providing an example of code to plot the phase portrait for the system x ̇1 = −x1 − 2x2 x21 + x2 , x ̇2 = −x1 − x2 over the region −0.5 ≤ x1 ≤ 0.5, −0.5 ≤ x2 ≤ 0.5, with the resulting figure shown.

Uploaded by

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

0.

0.4

0.2

-0.2

-0.4

-0.6

-0.8
-0.5 -0.4 -0.3 -0.2 -0.1 0 0.1 0.2 0.3 0.4 0.5

Using Matlab to draw phase portraits This is a quick notes to help you
draw phase portraits using the quiver command in Matlab. It is best to draw
the phase portrait in small pieces. The system we shall consider is

x˙1 = −x1 − 2x2 x21 + x2 , x˙2 = −x1 − x2

and we are interested in the region −0.5 ≤ x1 ≤ 0.5, −0.5 ≤ x2 ≤ 0.5. The
following matlab code shows how to do this:

[x1, x2] = meshgrid(-.5:0.05:0.5, -.5:.05:.5);


x1dot = -x1 - 2 *x2 .*x1.^2+x2; %Note the use of .* and .^
x2dot = -x1-x2;
quiver(x1,x2,x1dot, x2dot)

The resulting figure is as shown.

You might also like