vectors input to ODE 45
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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.
0 Kommentare
Antworten (1)
Walter Roberson
am 23 Feb. 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)
0 Kommentare
Siehe auch
Kategorien
Mehr zu Ordinary Differential Equations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!