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);

 采纳的回答

Change the last line, it should be a column vector
att2 = [Eq1 ;Eq2];

1 个评论

Wow, never thought of that.
Thanks a lot sir.
Hopefully I won't make such stupid mistakes in the future.
Regards.

请先登录,再进行评论。

更多回答(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