From: "Steven_Lord" <>
Newsgroups: comp.soft-sys.matlab
Subject: Re: What is wrong with this code?
Date: Fri, 19 Apr 2013 11:23:41 -0400
Organization: MathWorks
Lines: 38
Message-ID: <kkrnhs$ekd$>
References: <kkpg3a$rij$>
Mime-Version: 1.0
Content-Type: text/plain;
Content-Transfer-Encoding: 7bit
X-Trace: 1366385020 14989 (19 Apr 2013 15:23:40 GMT)
NNTP-Posting-Date: Fri, 19 Apr 2013 15:23:40 +0000 (UTC)
In-Reply-To: <kkpg3a$rij$>
X-Priority: 3
X-MSMail-Priority: Normal
Importance: Normal
X-Newsreader: Microsoft Windows Live Mail 14.0.8089.726
X-MimeOLE: Produced By Microsoft MimeOLE V14.0.8089.726
Xref: comp.soft-sys.matlab:793918

"Daniel " <> wrote in message 
> i have a function for an ODE but i keep on getting this message
> Error in ode_second_fun_main (line 5)
> [x,y]=ode45(@second_fun,tspan,x0,options);

Since you didn't give the full text of the error message, I will (line 
numbers may be a little different depending on the version of MATLAB you're 

Error using odearguments (line 91)
SECOND_FUN must return a column vector.

Error in ode45 (line 114)
[neq, tspan, ntspan, next, t0, tfinal, tdir, y0,
f0, odeArgs, odeFcn, ...

Error in ode_second_fun_main (line 5)

Have you checked whether or not your second_fun function returns a column 
vector? Try putting this line right before your call to ODE45 in 
ode_second_fun_main to check:

second_fun(0, x0)

Modify second_fun so that it does return a _column_ vector and see if that 
fixes the problem.

Steve Lord
To contact Technical Support use the Contact Us link on