Help with Periodic functions

2 次查看(过去 30 天)
Chance Morine
Chance Morine 2021-4-4
评论: darova 2021-4-4
Hello everyone. I have a question with a system of differential equations. I am trying to solve them using Euler's method. The functions are as follows.
dT1 = @(t,T1,T2) (((Ain*Qin)-((k2*(T1-T2+5))*A2)-((k1*(T1-Tout(t)))*A1))/(Cair*rho*V1));
dT2 = @(t,T1,T2) ((((k2*(T1-T2+5))*A2)-((k3*(T2-Tout(t)))*A3))/(Cair*rho*V2));
Where tout is a periodic function as follows.
Tout = @(t) -10*sin((2*pi*t)/(86400));
and the for loop for Euler's method.
i=1;
for i = 1:N-1
t(i+1) = t(i) + h;
T1(i+1) = T1(i+1)+h*dT1(t(i),T1(i),T2(i));
T2(i+1) = T2(i+1)+h*dT2(t(i),T1(i),T2(i));
end
The issue im running into is with the plot of T1 and T2. The periodic function is working correctly. But since T1 and T2 are defined with a periodic function, they should also be periodic. However, I am getting a completelely linear response. Any ideas?

回答(1 个)

Chance Morine
Chance Morine 2021-4-4
Found it actually!

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

产品


版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by