Plotting with different y-axes range in Matlab

In summary, you can use the plot command in Matlab to put multiple plots on the same graph, even if they have different y-axis ranges. Just make sure your data arrays are the same size and use the name/value pair arguments to customize the graph.
  • #1
adeeyo
20
0
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


adeeyo
 
Physics news on Phys.org
  • #2
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','*')
 

What is the purpose of plotting with different y-axes range in Matlab?

The purpose of plotting with different y-axes range in Matlab is to visualize multiple data sets with varying ranges on the same plot, making it easier to compare and analyze the data.

How do I plot with different y-axes range in Matlab?

To plot with different y-axes range in Matlab, you can use the plotyy function, which allows you to specify different y-axes for each data set being plotted.

Can I customize the y-axes range in Matlab?

Yes, you can customize the y-axes range in Matlab by using the ylim function, which allows you to specify the minimum and maximum values for the y-axes.

Can I add a secondary y-axis in Matlab?

Yes, you can add a secondary y-axis in Matlab by using the plotyy function and specifying the data sets and ranges for each y-axis.

How do I label the y-axes in a plot with different ranges in Matlab?

To label the y-axes in a plot with different ranges in Matlab, you can use the ylabel function to specify the label for each y-axis.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
886
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
968
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
5K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
719
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
10
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
999
Back
Top