graph (some basic)
8 次查看(过去 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!