- Tt0 is known (your example is 290).
- Tt1 = 3600*Tt0 + 360*Twout(1) / (3600 + 360)
- Tt2 = 3600*Tt1 + 360*Twout(2) / (3600 + 360), and so on
How can I do an calculation where it uses the previous answer to calculate the next
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
rammah nagi
am 6 Aug. 2019
Kommentiert: rammah nagi
am 6 Aug. 2019
So I want to model how a water tank changes in temperature when water is put in. So my Tank is 3600 L capacity and the flow into the water is 360 L/hr. If the water temperatre at the start is 290 Kelvin and the water temperature entering over 24 hours is as follows:
So this is what i need to do.
(3600*Tt+360*Twout/(3600+360)) %where Twout is as shown in the picture
%Tt is the variable that changes every hour so for the first hour Tt is equal to 290, but in the second hour it is equal to (3600*Tt+360*Twout)/ and so on for 24 hours
2 Kommentare
Renato SL
am 6 Aug. 2019
From what I understand:
Is this it?
Akzeptierte Antwort
Renato SL
am 6 Aug. 2019
I would do something like this
Tt = 290; %temperature at the start
for i=1:24 %loop for 24 hours
temp = (3600*Tt(end) + 360*Twout(i)) / 3960; %basically, your formula
%Tt(end) to call the last value of Tt which is the result of the last computation
%Twout(i) for corresponding Twout value
Tt = [Tt temp]; %updating the value of Tt with the value of the last computation
end
3 Kommentare
Renato SL
am 6 Aug. 2019
Actually, please recheck the formula since the one that you write basically makes the value goes to infinity
temp = 3600*Tt(end) + 360*Twout(i) / (3600+360);
%basically temp = 3600*Tt (adds a minimum of 4 digits to the value) + a small addition
so that in my answer I put the brackets to the addition before the division
temp = (3600*Tt(end) + 360*Twout(i)) / (3600+360);
%so that temp = (hundreds of thousands) / (thousands)
% temp = a value in hundreds
I don't know the exact formula so please don't just use what I put as the answer.
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!