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

 Risposta accettata

Jan
Jan il 19 Ago 2018
Modificato: Jan il 19 Ago 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 Commento

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

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Programming in Centro assistenza e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by