Anda di halaman 1dari 11

One Word: Simulink.

Using Simulink/Matlab to Solve Ordinary Differential Equations


Jake Blanchard University of Wisconsin 2009

Introduction
Matlab offers several approaches for solving initial value ordinary differential equations Runge-Kutta solutions are common (ode45, ode15s, etc.) Simulink is a Matlab add-on that allows one to simulate a variety of engineering systems We can use Simulink to solve any initial value ODE

Process

Simulink offers a variety of components that are assembled graphically to provide a full system simulation

http://www.engin.umich.edu/class/ctms/simulink/model/model.htm

An Example

Consider a model for a damped, forced oscillator

d x dx 3 4 x 5 cos(2t ) 2 dt dt x(0) 0 dx (0) 0 dt

Preparation

d x dx 5 cos(2t ) 3 4 x 2 dt dt

The Simulink Model


2 Clock t->2t cos 2t->cos2t) 5 5cos(2t)

1 s d2x/dt 2->dx/dt

1 s dx/dt ->x Scope

3 dx /dt ->3dx/dt

4 x->4x

The Simulink Model

d x dx 5 cos(2t ) 3 4 x 2 dt dt

The Simulink Model


d 2x dx 5 sin(2t ) 3 4 x dt 2 dt
d 2x dt 2

dx dt

dx dt

4x

Initial Conditions
The ICs are set in the integrator blocks Right click the block and open Integrator Parameters This sets value of output variable from the integrator block

Demo

Anda mungkin juga menyukai