vectors input to ODE 45

1 visualización (últimos 30 días)
Oday Shahadh
Oday Shahadh el 23 de Feb. de 2017
Respondida: Walter Roberson el 23 de Feb. de 2017
I have a transient equation below
dT/dt=Qs+Qa+Qir- seg*T
where:
Qs=sun power (watt/m2) % length( 6000,1)
Qa=Earth albedo power (watt/m2) % length( 6000,1)
Qir=Earth radiation power (watt/m2) % length( 6000,1)
Qs , Qa and Qir, already estimated and take the length of( 6000,1) for each power vector
Te0= 300 k (initial temperature)
options=odeset('AbsTol',10^-12,'RelTol',10^-9);
[t,data]=ode45('F1T',tspan,DataIn,options);
function F1T=F1T(t,data)
%TEMPERATURE INTEGRATION
Tdot=((QsunF1+QaF1+QirF1)- T^4
F1T=[Tdot];
end
and I got this error
Error using odearguments (line 92)
F1T returns a vector of length 0, but the length of initial conditions vector is 1. The vector returned by F1T and the initial conditions
vector must have the same number of elements.

Respuestas (1)

Walter Roberson
Walter Roberson el 23 de Feb. de 2017
You have
function F1T=F1T(t,data)
You need to use a different name for the function and the variable, or MATLAB is going to get confused (and the programmers reading the code are going to get even more confused.)
You have
function F1T=F1T(t,data)
%TEMPERATURE INTEGRATION
Tdot=((QsunF1+QaF1+QirF1)- T^4
F1T=[Tdot];
end
But none of QsunF1, QaF1, QirF1, or T are defined or accessible within the scope of the function. Notice you are passing in t (lower-case) but using T (upper-case)

Categorías

Más información sobre Ordinary Differential Equations en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by