Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Matlab: Graphing Heat transfer

  1. May 12, 2010 #1
    1. The problem statement, all variables and given/known data


    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.

    2. Relevant equations

    hold on;

    3. 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

    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
    1. The problem statement, all variables and given/known data

    2. Relevant equations

    3. The attempt at a solution

    Attached Files:

  2. jcsd
  3. May 12, 2010 #2


    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    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?
  4. May 12, 2010 #3
    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!
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook