How to solve these ode45 errors?
이전 댓글 표시
Greetings
I'm trying to solve some problems of thermal systems in matlab (we only care about ODEs of course)
So I've created two files with their own code, one for the functions and parameters and the other for the ode45
My error messages:
??? Error using ==> odearguments at 101
THERMEX22 must return a column vector.
Error in ==> ode45 at 172
[neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, odeFcn, ...
Error in ==> thermex22sol at 3
[t,A] = ode45('thermex22',[0 100],[300;300]);
The functions & parameters code:
function att2 = thermex22(t,A)
c1 = 1e3;
c2 = 2e3;
r1 = 2.5e-3;
r2 = 1.5e-3;
a = 300;
b = 1500;
q1o = (1/r1) * (A(1) - A(2));
q2i = (1/r1) * (A(1) - A(2));
q2o = (1/r2) * (A(2) - a);
Eq1 = (1/c1) * (b - q1o);
Eq2 = (1/c2) * (q2i - q2o);
att2 = [Eq1 , Eq2];
The ode45 code:
clc
clear
[t,A] = ode45('thermex22',[0 100],[300;300]);
plot(t,A);
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Programming에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!