From MurrayWiki
Jump to: navigation, search

When calling the phaseplot command, be sure that you are correctly inputting the arguments. Below is a proper example of how to call phaseplot:

phaseplot('f',X1Range,X2Range, scale, Xinit)

phaseplot('oscillator', [-1 1 10], [-1 1 10], 0.1,boxgrid([-1 1 10], [-1 1 10]))

Note that oscillator is the function that defines the derivative (look at week two and download oscillator.m if you don't know how to define the derivative function) and it is called with apostrophes:

Correct way: 'oscillator'

Incorrect ways: oscillator or @oscillator

X1Range and X2Range are of the form [min, max, num]. They define the axes of the plot and num determines how many arrows will be drawn along each corresponding axis. Make sure that the axes ranges include the equilibrium points. Scale is the final argument and it scales the arrows created on the quiver plot; 0.1 seems to be a good choice, but if your arrows are to small or too big try a different scale factor.

Finally, Xinit determines what points to start the trajectories that get drawn on the phase diagram. For this you can either just make a list of points around the edge of the axes or you can use Professor Murray's boxgrid.m which is located on the Week 2 page of the wiki. If you choose to use boxgrid, call it as follows:

boxgrid(X1Range, X2Range)

X1Range and X2Range don't have to be the same as those that were put into the phaseplot command, but they do take the same form: [min max num].

NOTE: If you are going to use boxgrid on this problem, you need to do a small alteration to the boxgrid.m file. Open the boxgrid.m file and delete the first element,which is a zero, of both the sx1 and sx2 vectors defined on lines 11 and 12.

-- Max Merfeld