How to Graph Temperature Variation in Matlab?

Click For Summary
SUMMARY

The discussion focuses on graphing temperature variation in Matlab for a heat transfer problem. The user seeks a method to plot temperature changes against distance without manual intervention, using a script in a ".m" file. The solution involves plotting temperature at material interfaces and connecting these points with straight lines using the syntax plot([x1 x2 x3],[T1 T2 T3]). This approach simplifies the graphing process by eliminating the need for complex loops.

PREREQUISITES
  • Familiarity with Matlab programming and syntax
  • Understanding of heat transfer concepts and temperature variation
  • Knowledge of plotting functions in Matlab
  • Basic understanding of linear interpolation
NEXT STEPS
  • Explore Matlab's plot function in detail
  • Learn about linear interpolation techniques in Matlab
  • Research heat transfer equations relevant to temperature variation
  • Investigate automation of graphing in Matlab without user input
USEFUL FOR

This discussion is beneficial for students, engineers, and researchers working on heat transfer problems, particularly those using Matlab for data visualization and analysis.

dropdeadmarc
Messages
4
Reaction score
0

Homework Statement



attachment.php?attachmentid=25746&stc=1&d=1273715951.png


I've been given a Heat transfer problem, which I must solve in Matlab.
The code should output the results and a graph of the temperature variation within the wall.

Also the code needs to be able to run and output these results without any further user manipulation to the graphs via the mouse. All commands in a ".m" file.

Homework Equations



hold on;
plot(t',h')

The Attempt at a Solution



I have no problem solving for the temperature change and rate of heat loss. I'm just having a problem with how to graph the temperature change versus the distance. I'm assuming it should be similar to the image supplied.

I figured I could do something like the following, where it would plot individual points:

hold on;
while t< the thickness of each transition
find temp
plot
t=t+.1
end

However, this is overly complicated and would take a lot of time to set up. The temperature change throughout each material is linear. So I would think that If I just calculate the temperature at the material change points, I could just plot those points, and then connect these points with lines.

Is there some syntax that would make this possible to code?
I tried searching online and using "help plot" but to no avail
 

Attachments

  • Picture.png
    Picture.png
    4.7 KB · Views: 777
Physics news on Phys.org
Hi dropdeadmarc, welcome to PF. Just plot the temperatures of the interfaces against the locations of the interfaces. The regions in between will be connected by straight lines (e.g., plot([x1 x2 x3],[T1 T2 T3])). Does this answer your question?
 
Mapes said:
Hi dropdeadmarc, welcome to PF. Just plot the temperatures of the interfaces against the locations of the interfaces. The regions in between will be connected by straight lines (e.g., plot([x1 x2 x3],[T1 T2 T3])). Does this answer your question?

Thats exactly what I was looking for. I've only used Matlab to plot individual points and lines based on functions. I don't know why I didn't try that though.
Thank you so much!
 

Similar threads

Replies
22
Views
4K
  • · Replies 13 ·
Replies
13
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 12 ·
Replies
12
Views
3K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 0 ·
Replies
0
Views
2K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 1 ·
Replies
1
Views
4K