15.11.2014 Views

MATLAB Mathematics - SERC - Index of

MATLAB Mathematics - SERC - Index of

MATLAB Mathematics - SERC - Index of

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Initial Value Problems for ODEs and DAEs<br />

Note For information on function handles, see the function_handle (@),<br />

func2str, and str2func reference pages, and the Function Handles chapter <strong>of</strong><br />

“Programming and Data Types” in the <strong>MATLAB</strong> documentation.<br />

4 View the solver output. You can simply use the plot command to view the<br />

solver output.<br />

plot(t,y(:,1),'-',t,y(:,2),'--')<br />

title('Solution <strong>of</strong> van der Pol Equation, \mu = 1');<br />

xlabel('time t');<br />

ylabel('solution y');<br />

legend('y_1','y_2')<br />

3<br />

Solution <strong>of</strong> van der Pol Equation, µ = 1<br />

y 1<br />

y 2<br />

2<br />

1<br />

solution y<br />

0<br />

−1<br />

−2<br />

−3<br />

0 2 4 6 8 10 12 14 16 18 20<br />

time t<br />

As an alternative, you can use a solver output function to process the output.<br />

The solver calls the function specified in the integration property OutputFcn<br />

after each successful time step. Use odeset to set OutputFcn to the desired<br />

5-11

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!