ODE45 - must return a column vector.
이전 댓글 표시
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!
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Solar Power에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!