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

 采纳的回答

Jan
Jan 2018-8-19
编辑:Jan 2018-8-19
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 个评论

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

请先登录,再进行评论。

更多回答(0 个)

类别

在 帮助中心 和 File Exchange 中查找有关 Programming 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by