Plotting of integral curves

The output of ode23 for a set of two differential equations as in equation (5.2), say $ t$ and $ x$ where $ t$ is the time vector and $ x$ the corresponding states, can also be used for drawing the phase plane. To this end, you need to plot the solutions $ x_1(t)$ and $ x_2(t)$ in the [$ x_1$ , $ x_2$ ]-plane. This can be achieved by plotting the second column of $ x$ versus the first column of $ x$ after you have used the command ode23:

>> plot(x(:,1),x(:,2))

This gives a figure with one integral curve. If you want to draw several integral curves with different plot commands in the same figure, then you have to enter the command hold on after the first plot command (see Chapter 1). If you draw the integral curves and the direction field in one figure, then the direction vectors will be tangent to the integral curves. You can also draw an integral curve by assigning the property odephas2 to `OutputFcn' in the ode-solver. The command:

>> ode23('deq',[0,1],[2,8],odeset('OutputFcn','odephas2'))

results in a two-dimensional integral curve from the given initial condition.



Previous      Next      Up      Contents


Esteur 2010-03-22