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

A quick question regarding matlab

  1. Oct 3, 2011 #1

    Well since i'm a beginner in Matlab i have a question aboute ploting the graph. How can I merge two graphs into one ? Since i have function test(x,h) and function test2(x,h) both of them plotts in a two separate graphs. How do i do if i want to see both of them in a single graph ?


    Carl F
  2. jcsd
  3. Oct 3, 2011 #2


    User Avatar
    Science Advisor

    One way is to make your functions return a vector rather than just plotting it. Then it would be something like:

    y1 = test1(x,h)
    y2 = test2(x,h)
  4. Oct 3, 2011 #3


    User Avatar
    Science Advisor
    Gold Member

    This will also plot them on one graph:

    hold on
    hold off
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook