댓글 수: 5

KSSV
KSSV 2020년 7월 25일
You need to read about plot. But in the above do you have any array?
John D'Errico
John D'Errico 2020년 7월 25일
It seems you might want to plot temperature, as a function of time? A plot is just a figure that shows two variables x and y, plotted against each other. So in this case, time is the x axis, temperature the y axis. So where have you created the time and temperature variables to plot?
KSSV
KSSV 2020년 7월 25일
Don't attach your code as a image snippet. Copy the code here, so that people can copy and help you in case they have idea on your problem/ questions.
Stephen23
Stephen23 2020년 7월 26일
Original question by Mark Edison Arzobal retrieved from Google Cache (complete with SHOUTING):
"PLOTTING NEWTON'S LAW OF COOLING"
HOW CAN I PLOT THESE CODES IN MATLAB?
Walter Roberson
Walter Roberson 2020년 7월 26일
Mark Edison Arzobal : If you feel that the question is unclear, then as you are the person who posted the question, you should be the one that clarifies it.

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

답변 (1개)

Alan Stevens
Alan Stevens 2020년 7월 25일

0 개 추천

I guess you want to plot Temperature as a function of time. Something like this perhaps:
% Data
T1 = 79.5; % temperature at time t = t1 hours;
T2 = 78; % temperature at time t = t1 + 1 hours
T0 = 98.6; % temperature at time t = 0 hours
TS = 69; % room temperature
% Newton's law of cooling function
T = @(t,k) TS + (T0 - TS)*exp(-k*t);
% Obtain k and t1
kt1 = log( (T0 - TS)/(T1 - TS) );
kt2 = log( (T0 - TS)/(T2 - TS) );
t1 = 1/(kt2/kt1 - 1);
k = kt1/t1;
% Plot temperature decay curve
t = 0:0.1:10; % times in hours
Temps = T(t,k);
plot(t, Temps), grid
xlabel('time [hrs]'), ylabel('temperatures [F]')

댓글 수: 2

Alan Stevens
Alan Stevens 2020년 7월 25일
You should run it to see!
Alan Stevens
Alan Stevens 2020년 7월 25일
This means let t take the values 0, then 0.1, then 0.2, then 0.3, ... etc all the way up to 10. It sets up an array with t taking on values from 0 to 10 in steps of size 0.1. These values are then passed to the function T, which calculates values of temperature at each of those values of t.

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

카테고리

도움말 센터File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

질문:

2020년 7월 25일

댓글:

2020년 7월 26일

Community Treasure Hunt

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

Start Hunting!

Translated by