ODE45 - must return a column vector.
Afficher commentaires plus anciens
I have following code:
B = readtable('t13.xlsx');
t13 = table2array(B);
c = readtable('ambient.xlsx');
ambient = table2array(c);
d = readtable('solar.xlsx');
solar = table2array(d);
tspan = [0 50];
y0 = 20;
[t,y14] = ode45(@(t,y14) odefcn(t,y14,t13,solar,ambient), tspan, y0);
function dy14dt = odefcn(t,y14,t13,solar,ambient)
dy14dt = zeros(50,1)
dy14dt = [-1.3461*y14 - 1.3556*t13 + 4.3505*solar -1.3556*ambient];
%dy14dt= dy14dt(:);
end
I am getting an error as follows:
Error using odearguments
@(T,Y14)ODEFCN(T,Y14,T13,SOLAR,AMBIENT) must return a column vector.
Error in ode45 (line 107)
odearguments(odeIsFuncHandle,odeTreatAsMFile, solver_name, ode, tspan, y0, options, varargin);
Error in validation (line 11)
[t,y14] = ode45(@(t,y14) odefcn(t,y14,t13,solar,ambient), [0 41.5], y0);
Based on one of the previous post, I tried putting this line: dy14dt= dy14dt(:); but it did not work. Kindly help me to solve this error. Thanks!
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Programming dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!