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

 Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 19 Oct 2013
Edited: Azzi Abdelmalek on 19 Oct 2013
Change the last line, it should be a column vector
att2 = [Eq1 ;Eq2];

1 Comment

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

Sign in to comment.

More Answers (0)

Categories

Find more on Programming in Help Center and File Exchange

Asked:

Max
on 19 Oct 2013

Commented:

Max
on 19 Oct 2013

Community Treasure Hunt

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

Start Hunting!