Solving ODEs (differential equations)

One way to create a second-order ode is to type
Variable x'' = cos(2*t) + sin(x)
Note: t is an independent variable (e.g., time).
Note: The prime symbol ' denotes differentiation with respect to t.
Note: Commands may be entered from a text file, e.g.,   SecondOrderODE.txt.

To input values (and units) for numerical integration parameters, type

Input  tFinal=20 sec, integStp=0.02 sec, absErr=1.0E-08, relErr=1.0E-08

To input initial values (with units) for x and x', type

Input  x=1 m, x'=0.2 m/sec
MotionGenesis Second Order ODE .jpg
To output various quantities (with units) when the Code command is issued, type
Output t sec, x m, x' m/sec, x'' km/sec^2, 3*x^2 ft^2

To immediately solve the ode and output to the file   SecondOrderODE.1,   type

ODE() SecondOrderODE

The data in this file can be   plotted   as   shown above   with a plotting program.
Note: For example, on PC Windows, use   MotionGenesis Plotting Software.



Generating code to solve differential equations

MotionGenesis also produces highly efficient and symbolically optimized C, Fortran, MATLABŪ, ..., codes.
The table below shows how to generate various codes to solve the ODE.
Depending on your   license,   these deployable codes are independent of MotionGenesis.
For example, to produce C code, enter the command   ODE() SecondOrderODE.c
To produce MATLABŪ code, use   ODE() SecondOrderODE.m
Note: Other than .mSFunction, each code outputs to   SecondOrderODE.1   which can be   plotted   as   shown above.

Code
Command and code file
Comments
C
ODE() SecondOrderODE.c Compile and link source code.
Modify input values in   SecondOrderODE.in
Note: Compiled codes optimize for its processor.
Fortran
ODE() SecondOrderODE.f Compile and link source code.
Modify input values in SecondOrderODE.in
Note: Compiled codes optimize for its processor.
MATLABŪ
ODE() SecondOrderODE.m Modify input values in   SecondOrderODE.m
Note: Interpreted .m codes are slower than compiled codes.
MATLABŪ/SimulinkŪ
ODE() SecondOrderODE.mSFunction Modify input values in   SecondOrderODE.m
Note: Interpreted .m codes are slower than compiled codes.



Copyright (c) 1988-2011. All rights reserved.