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

Plotting with different y-axes range in Matlab

  1. Dec 23, 2012 #1
    Good Day Everybody,

    Please assist me on these problems

    1. I wish to put six plots on the same plot using matlab. The details of each plot are stated below

    PLOT 1
    x axis range 0:1
    y axis range 0:1

    PLOT 2
    x axis range 0:1
    y axis range 0:1

    PLOT 3
    x axis range 0:1
    y axis range 0:1

    PLOT 4
    x axis range 0:1
    y axis range 0:1

    PLOT 5
    x axis range 0:1
    y axis range 0:2

    PLOT 6
    x axis range 0:1
    y axis range 0:7


    Please how do I put all these plots on one single plot despite different y axis range?

    Thanks

    Best regards,
    adeeyo
     
  2. jcsd
  3. Jan 9, 2013 #2

    kreil

    User Avatar
    Gold Member

    Hey adeeyo.

    Once you have the arrays of values to be plotted defined, the plot command will automatically resize the window. For example, let's try to put an example PLOT1 and PLOT6 from your list on the same graph:

    x1 = 0:0.1:1;
    y1 = 0:0.1:1;

    x6 = 0:0.1:1;
    y6 = 0:0.7:7;

    plot(x1,y1,x6,y6)

    *make sure your data arrays are the same size!

    In general, you can use any number of data pairs in plot: i.e. plot(x1,y1,x2,y2,x2,y3,x4,y4,...) with name/value pair arguments after the data sets to change things like line color or point type: plot(x1,y1,'color','b','*')
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Plotting with different y-axes range in Matlab
Loading...