odephas3

ODE output function: 3-D phase space plot, drawn while the solver runs.

Category: Other public functions: funfun

Syntax

status = odephas3(t, y, flag)

Output-function form: called by the solver at the start, at each accepted step and at the end.

Description

Used through odeset('OutputFcn', @odephas3). At each step it extends a 3-D curve that plots the first three components of the state against each other, which is the usual way to look at a system such as the Lorenz equations. The system must have at least three components.

Input arguments

t, y
Time points and state columns passed in by the solver.
flag
'init', '' or 'done'.

Output arguments

status
Logical, true to stop the solver. Always false here.

Example

Lorenz attractor

lorenz = @(t, y) [10*(y(2) - y(1)); y(1)*(28 - y(3)) - y(2); y(1)*y(2) - 8/3*y(3)];
opts = odeset('OutputFcn', @odephas3);
[t, y] = ode45(lorenz, [0 5], [1; 1; 1], opts);

In the app, the 3-D trajectory is drawn below the code.

See also

odephas2 odeplot odeprint odeset ode45