graph (some basic)
조회 수: 3 (최근 30일)
이전 댓글 표시
I wanna know if we wish to plot graph and its based on some equations result, of for example Temperature vs time.. and the values I wish to have on X as (t:dt:tend) and this values are inputs..to draw graph for y axis as calculated value of Temperature..
I am trying this way
x = [t : dt: tend];
y = Tn;
figure
plot(x, y, 'r')
But I am not getting the result; because I learned that y got to be the function of x, but I dont know what to use as if u use f(x) its not accepting here, so what else I can do
댓글 수: 4
채택된 답변
Walter Roberson
2020년 5월 20일
prompt = 'What is the value of Area, A? ';
A = input(prompt)
prompt = 'What is the value of Heat Transfer Coefficient, h? ';
h = input(prompt)
prompt = 'What is the value of Temperature of System, Ts? ';
Ts = input(prompt)
prompt = 'What is the value of Temperature of Surroundings, Tf? ';
Tf = input(prompt)
prompt = 'What is the value of mass, m? ';
m = input(prompt)
prompt = 'What is the value of Heat Capacity, c? ';
c = input(prompt)
prompt = 'What is the value of time interval, dt? ';
dt = input(prompt)
prompt = 'What is the value of time at the end, tend? ';
tend = input(prompt)
q2 = 150;
tvals = 0 : dt : tend;
num_t = length(tvals);
Tn = zeros(1, num_t);
for tidx = 1 : num_t
t = tvals(tidx);
q1 = - A*h*(Ts - Tf);
Q = (q1+q2)*dt;
Ts = (Q/(m*c)) + Ts;
Tn(tidx) = Ts;
end
plot(tvals, Tn);
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!