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

 채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2013년 10월 19일
편집: Azzi Abdelmalek 2013년 10월 19일

1 개 추천

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

댓글 수: 1

Max
Max 2013년 10월 19일
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에 대해 자세히 알아보기

질문:

Max
2013년 10월 19일

댓글:

Max
2013년 10월 19일

Community Treasure Hunt

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

Start Hunting!

Translated by