Show temperature difference (delta) between 2 temps in a graph
6 次查看(过去 30 天)
显示 更早的评论
Hi peeps, new to matlab, i want to show in my channel a graph showing the delta difference between 2 temperatures as a bar graph, so its easy to see where the difference is not optimal for my heat pump, ie between 4 and 5 degrees c.
Can anyone help with some sample code pls?
ta
steve
2 个评论
the cyclist
2021-11-27
% Make up some data. (Use your real data instead)
rng default
T1 = rand(1,7);
T2 = rand(1,7);
plot(T2-T1)
Now, explain why that doesn't work for you, and I'll explain that you should have given us a lot more detail in your original question. :-)
回答(3 个)
the cyclist
2021-11-27
Here is an example similar to what posted in my comment, but added line and text:
rng default
x = rand(1,5);
mean_x = mean(x);
figure
bar(x)
yline(mean_x,'r')
text(0.05,0.95,sprintf('Mean x value is %7.3f',mean_x))
You can read the documentation of all the commands I used, to see more details on how to use MATLAB. This forum is really the best for learning MATLAB from the ground up. I would suggest watching the MATLAB Onramp tutorial, and perhaps take a look at the code in the MATLAB Plot Gallery for ideas on making different types of plot.
Steven Langston
2021-11-28
1 个评论
the cyclist
2021-11-28
编辑:the cyclist
2021-11-28
% Example temperature input
T = [1 2 3 4 5 6 7 8];
% True/false vector corresponding to elements greater than 3
T > 3
% True/false vector corresponding to elements greater than 3 and less than 6
(T>3) & (T<6)
% The elements of T that are >3 and <6
T((T>3) & (T<6))
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!