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

Matlab - graphing multivariable functions

  1. Jan 16, 2008 #1
    I am taking a vector calculus course and am having trouble figuring out how to graph things in Matlab to verify my answers.

    Here is exactly what I want to do:
    I want to graph side by side two different graphs simultaneously, so I can compare them.

    I will give you the equations of the two planes I am attempting to graph side by side. If someone could write the code for me to graph these side by side, then I am sure I can play around with the code and figure out how to graph other functions.

    I want to graph side by side the planes:
    Z = (-1/4)x + y - 19
    Z = (-1/3)x + (2/3)y - 4

    Thanks in advance!
    Last edited: Jan 16, 2008
  2. jcsd
  3. Jan 17, 2008 #2
  4. Jan 17, 2008 #3
    Type "help subplot". This tells you how to plot multiple graphs in the same figure for convenient pictures
  5. Jan 17, 2008 #4
    I have tried that, but I still don't understand how to do it.

    If someone could write the code to do what I am trying to do for those two equations I gave, then I would be EXTREMELY grateful.
  6. Jan 17, 2008 #5
    Is this enough? It will show you how to plot two vectors next to each other.

    Code (Text):

    t = 0:0.01:10;
    f1 = sin(t);
    f2 = cos(t);


  7. Jan 18, 2008 #6
    Awesome! Thanks!
  8. Jan 18, 2008 #7
    Try explot also.

    ezplot((-1/4)x + y - 19) I think that should work. If not try
    plot3d((-1/4)x + y - 19),x,-10,10,y,-10,10) x and y ranges are -10 to 10
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook