Using MATLAB, How would you calculate the temperature for an hour. I\'ve tried d
ID: 2082131 • Letter: U
Question
Using MATLAB, How would you calculate the temperature for an hour. I've tried doing so even when setting T(0) = 100, but get an error : "Subscript indices must either be real positive integers or logicals."
Suppose we measure the change in the temperature of a cup of tea every minute. We find that it changes roughly at the rate k, so that we can describe the dynamics as a difference equation as follows: n-1 n 1 Here Tr is the temperature of the tea at time n and k is the rate of cooling. For simplicity, we will assume room temperature is zero. Hint: Be careful to re-write this equation in our usual form! 1. Calculate the temperature for an hour (n 60 mins), assuming the rate of cooling k 1 and the initial temperature, To 100Explanation / Answer
Time=60; % Time for calculating the temperature;
To=100; % Initial temperature in degree Centigrades
k=-0.1; % rate of cooling;
Told=To;
for n=1:Time;
Tnew=Told*(1+k); % Tnew-Told=k*Told
Told=Tnew;
end
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.