For example as shown in the function below: Where Ts
is the variable with initial value, while Qu
is input but it changes with time having specific values defined in the matrix.
M-file:
function Ts=temp(t,Ts,Qu)
Ts=Qu/(1500*4190)-12*10^6/(1500*4190)-11.1*3600*(Ts-20)/(1500*4190);
I am using in this way:
Qu=[0 0 0 0 0 0 0 0 21 41 60 75]
for j=1:12
Qu=Qu(t);
[t,Ts]=ode45(@(t,Ts)temp(t,Ts,Qu),(1:1:12),45)
end
But it is giving an error. Please explain how to use the inputs with changing time with this example.