Physics Forums

Physics Forums (
-   Math & Science Software (
-   -   MatLab help using ode23/ode45 (

louie Mar8-04 10:11 AM

MatLab help using ode23/ode45
I want to use matlab ode23 or ode45 to solve the following problem,
(ignore the periods '.' as they are there to line up the vector spaces)

.... Ids ....0.5Ids-0.3Iqs-0.4Idr-0.1IdrIqr ........ 0.2Vd
d ..Iqs = -0.3Ids+0.5Iqs+0.8Idr-0.2Iqr^2 . . + . 0.2Vds
dt .Idr ...-0.5Ids+0.1Iqs+0.7Idr+0.6IdrIqr ......... 0
.. . Iqr ... 0.9Iqs-0.5Iqs-0.4Idr+0.3Iqr^2 .......... 0
.... Wm .. 0.27(IdrIqs-IqrIds)-0.1Wm-0.85 ........ 0

Any help explaining the correct input syntax would be greatly appreciated (as I'm not that familiar with MatLab).


louie Mar8-04 10:51 AM

correction original post....should say -0.1Iqr not -0.1IdrIqr,
-0.2Iqr not -0.2Iqr^2, 0.6Iqr not 0.6IdrIqr, 0.3Iqr not 0.3 Iqr^2

enigma Mar8-04 12:19 PM

Hi louie,

I'm not sure I understand what you're trying to do.

For ode45, you need two files. One which is your differential updater, and one which is the main function which calls it.

the differential function should return a vector which is the derivatives and read in time steps you want to look at and the original state vector.

The main file should set up the state vector and pass it.

for example, the differential function:


function dW=differential(t,W)


for the calling function:

function [t,W]=odesolver("input variables")

W_0= [X_0;Y_0];



This will return the values for W at the points designated by t

All times are GMT -5. The time now is 06:32 AM.

Powered by vBulletin Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2014 Physics Forums