1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Matlab, plot

  1. May 8, 2012 #1
    I have a set of measured data. I need to plot this in matlab and show two graphs in one plot.
    Data for first graph is : [0.35,0],[0.4,130],[0.45,400],[0.5,0.11],[0.55,34] and so on.
    Second graph is a function.

    So, how to plot sequence of data in matlab? Which command should I use?
     
  2. jcsd
  3. May 8, 2012 #2
    Try the following:

    x = [0.35 0.4 0.45 0.5 0.55] % (defines the x values in a vector)

    y = [0 130 400 0.11 34] % (defines the y values in a separate vector)

    plot(x,y) % (makes a plot of y plotted against x)
     
  4. May 8, 2012 #3
    how to display two plots plot1 and plot 2 in one graph? thank you
     
  5. May 8, 2012 #4
    You could do, for example,

    plot(x1,y1,x2,y2)

    By the way, the MATLAB documentation is quite thorough. Try typing "help plot" to learn more about the syntax and features of the plot function. Also, there's a ton of information on the web about using MATLAB in case you ever get stuck.
     
  6. May 13, 2012 #5
    #4 is right
     
  7. May 17, 2012 #6
    wait...
    its' gonna be plotyy(x1,y1,x2,y2)
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Matlab, plot
  1. Matlab Plot (Replies: 1)

  2. Matlab plot (Replies: 10)

  3. Plot in matlab (Replies: 1)

  4. Matlab Plots (Replies: 2)

  5. Matlab plots (Replies: 1)

Loading...