MATLAB Plotting with different y-axes range in Matlab

AI Thread Summary
To plot six different datasets on the same graph in MATLAB, despite varying y-axis ranges, users can utilize the plot command with multiple data pairs. For instance, to combine PLOT1 and PLOT6, define the x and y arrays for each plot, ensuring they are of the same size. The command would look like this: plot(x1, y1, x6, y6). Users can add additional datasets similarly by continuing to include x and y pairs. Customization options, such as line color and point type, can be applied using name/value pair arguments after the data sets. This method allows for effective visualization of multiple plots within a single graph.
adeeyo
Messages
20
Reaction score
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
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','*')
 

Similar threads

Replies
8
Views
2K
Replies
4
Views
5K
Replies
4
Views
2K
Replies
7
Views
2K
Replies
10
Views
3K
Replies
1
Views
2K
Back
Top