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

MATLAB 3D Plot assistance needed

  1. Oct 27, 2011 #1
    Hi guys! Kinda stuck here..

    I'm trying to plot the temporal temperature distribution across a metal rod of length 1 meter. The rod is heated at one end and the temperature is measured every 5 cm along the meter rod every 10 minutes for an hour.

    Basically I have 6 text files, each containing 20 temperature values. This will go on the z-axis.
    Then I have a vector y = [0:5:100]; for the position along the rod. Then I have another vector t containing the times at which i measured the temperature.

    So far I've used the load command to read in the data from the text files into 6 vectors. And I have the "position" vector y = [0:5:100]; . I'm not sure how to make this into a three dimensional plot though, I'm very new to matlab.

    Any help would be greatly appreciated!
    Thanks!
    Max
     
  2. jcsd
  3. Oct 27, 2011 #2
  4. Oct 27, 2011 #3

    jhae2.718

    User Avatar
    Gold Member

  5. Oct 28, 2011 #4
    Thanks for your reply, however I'm still unsure as to handle the 6 different text files.

    Code (Text):

    load plot1.txt
    load plot2.txt
    load plot3.txt
    load plot4.txt
    load plot5.txt
    load plot6.txt

    for i=1:6,
        [X] = meshgrid(0:10:60);
        [Y] = meshgrid(0:5:100);      
        [Z] = plot(i);
        mesh(X,Y,Z,'EdgeColor','black')
    end

     
    I'm guessing it will be something along the lines of this....?
     
  6. Nov 1, 2011 #5
    But this throws up an error
    Code (Text):
     ??? Error using ==> mesh at 80
    Z must be a matrix, not a scalar or vector.

    Error in ==> plots at 14
        mesh(X,Y,Z,'EdgeColor','black')
    Any ideas?
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: MATLAB 3D Plot assistance needed
  1. Matlab 3D Scatter Plot (Replies: 4)

  2. 3D plot using Matlab (Replies: 1)

  3. MATLAB, 3D plotting (Replies: 1)

Loading...