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

Matlab contour labels for PDEs

  1. Jan 9, 2009 #1
    Is there a way that I can label contours for PDEs on Matlab? They have a few functions for drawing contours, e.g.

    but they're unlabelled (what's the use!) I'm sure there's a way to label my contours if I could plot them in the first place, but searches yield none. I understand that there's a function

    but I can't think of how I can use it with given my data:

    p(1,:) is the matrix containing the x-coordinates of u(:,1)
    p(2,:) is the matrix containing the y-coordinates of u(:,1)
    u(:,1) gives the solutions.

    e.g. u(1) gives the solution at (p(1,1), p(2,2))

    I tried the obvious,

    which doesn't work as far as it goes because I realised X and Y refers to a grid rather than the coordinates of certain elements of Z. Similarly, Z are the values at the points in the grid, rather at only certain, irregularly spaced coordinates.

    Any help is appreciated, thanks in advance!
  2. jcsd
  3. Jan 9, 2009 #2

    Dr Transport

    User Avatar
    Science Advisor
    Gold Member

    Try this......

    cs = contour(X,Y,Z);
  4. Jan 9, 2009 #3
    Yep, I've tried that. It doesn't work. :frown: I need to find a way to transform my x, y coordinates and PDE solution values into a strange form (X and Y must be at least 2x2 matrices).

    Thanks nonetheless.
  5. Mar 21, 2009 #4
    Hi..I have the same problem !!! I cant label the contours which come from the pdeplot(...) or pdecont(...).
    Any solution ????

    ephedyn have u find anything ???? Please answer me..its important. thanks
  6. Mar 21, 2009 #5
    Hi, I'm sorry to disappoint you but I couldn't find a fix to this. I had to stick to a color map rather than contour labels, which is annoyingly inadequate.

    pdeplot(...colormap, 'jet'...)
  7. Mar 24, 2009 #6
    It's ok. Thank u for ur time.
  8. Mar 26, 2009 #7
    Hey Guys

    I would be grateful if you could have some time to look into my question, I am trying to do density plot (contour or surface or map)from a data file which has 3 columns.........the code below does not shows any errors, but also does not give any figure, I think may be the way I had added the extension manually(.csv......comma separated variables)...is there anyway to export my data in such extension file.....or if you have another way to plot data file by contour plot.........:cry::cry:

    Code (Text):
    data = csvread('my_file.csv');
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook