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
darova
darova 2021년 4월 4일
Please attach the whole code

댓글을 달려면 로그인하십시오.

답변 (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