THETA1 must return a column vector.

In solving ode45 function, this error was appeared :
>> Error using odearguments (line 93)
>>THETA1 must return a column vector.
>>Error in ode45 (line 115)
>> odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);
>>Error in Untitled2 (line 2)
>> [m, theta_int(0,:)]=ode45('theta1' ,0:.1:1,0);
as the function b=((w_theta./r).*((dr_m.*dz_s-dz_m.*dr_s)./(w_r.*dz_s-w_z.*dr_s))) is the equation demanded to solve with span 0:1

 Accepted Answer

Jan
Jan on 19 Aug 2018
Edited: Jan on 19 Aug 2018
As the error message say clearly: Your function theta1 is expected to return a column vector. You did not post this function, but I guess, it returns a row vector.
Your code will fail due to
theta_int(0,:)
also: In Matlab indices must by greater than 0. Prefer to define the function to be integrated as function handle instead of using a char vector. The latter is outdated for 15 years now, but still supported for backward compatibility.
[m, theta_int]=ode45(@theta1, 0:.1:1, 0);
Are you sure that the initial value is the scalar 0? If you integrate a scalar, theta1 should reply a scalar also.

1 Comment

thanks for your response, yes the initial value at m=0 is theta=0

Sign in to comment.

More Answers (0)

Categories

Find more on Programming in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!