HOME
PDF
Matlab source code nma_project_511.m.txt

Solving nonlinear ODE (Van Der Pol) numerically using Matlab's ODE45

Nasser M. Abbasi

sometime in 2009 page compiled on July 4, 2015 at 2:18am

Contents

1 Introduction
2 Matlab implementation
3 Results and output
 3.1 Test case 1
 3.2 Test case 2
 3.3 Test case 3
4 Conclusion

1 Introduction

Report for course EGME 511 (Advanced Mechanical Vibration). California state university, Fullerton, CA. Van der Pol differential equation is given by

          (         )
x ′′(t) − c 1 − x2(t) x′(t) + kx (t) = 0

In this analysis, we will consider the case only for positive c,k  .  The above equation will be solved numerically using Matlab's ODE45 for different initial conditions, and the phase portrait (velocity vs. displacement) is plotted to show the limit cycle for different initial conditions.

2 Matlab implementation

To use ODE45, one must first convert the above second order ODE to two ODE's, each of which is first order. Letting x1 = x, x2 = x′(t)  results in

          }               ′    ′                   }           ′              }
 x1 =  x                x 1 = x (t) = x2                       x1 = x2
x2 = x′(t)    x′2 = x′′(t) = c (1 − x2 )x′(t) − kx (t)   x′2 = c (1 − x21)x2 − kx1

The system of equations to be solved by ODE45 is the following

(  ′)    (                   )
  x1  =            x2
  x′2       c(1 − x21)x2 − kx1

Subject to initial conditions x1(0) = x(0)  and           ′
x2(0) = x (0)  . In the Matlab implementation below, the values of c,k  and the initial conditions are defined at the top of the code. This needs to be modified to change the initial conditions before running the program again.

3 Results and output

The program was run for a number of different initial conditions (different x (0)  and different v (0)  ). In all cases, c = 1, k = 1  was used. It is noticed that one limit cycle is reached in all cases. Both the x(t)  and the phase plot where shown. The following are output from 3 different runs made. The title on the plots show the initial conditions used.

3.1 Test case 1

PIC

3.2 Test case 2

PIC

3.3 Test case 3

PIC

4 Conclusion

A non-linear second order ODE was solved numerically using Matlab's ode45. The solution to the Van Der Pol was found to contain a limit cycle in the phase portrait when starting from any initial conditions.