0% found this document useful (0 votes)
3 views

Multigraph and Subplot

Uploaded by

Shahariar Nahid
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Multigraph and Subplot

Uploaded by

Shahariar Nahid
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Introduction: Graphs and multigraphs are effective visual tools because they present information quickly and easily.

In a multigraph we can show more than one function in a single graph. In a multigraph or subgraph we can compare
many function in a single graphical window. In this report we discuss about multigraph and subgraph.

Objective: In this report we show how to create three types of multigraph and a subgraph in MATLAB.
Methodology: We can create a multigraph in 3 methods. Now we will see these 3 methods.
Multigraph
First Method: First we have to put a domain and multiple range. Then we write “plot(domain,range)”.
Example: X= -10:0.5:10; Domain
Y1= sin(X).*cos(X);
Range
Y2= sin(X).*exp(0.5);
plot(X,Y1,X,Y2)
Second Method: In this case one domain should be taken for each range and each domain will have a different name
but the value of the domain will be the same. Then “Domain=[ domain domain …. ]”;Range=[ range range …. ].Then we
write “plot(domain,range)”. Example: X1= -10:0.5:10;
Y1= sin(X1).*cos(X1);
X2= -10:0.5:10;
Y2= log(X2)+exp(1.5*X2);
X3= -10:0.5:10;
Y3= 10:2:90;
X=[X1 X2 X3];
Y=[Y1 Y2 Y3];
plot(X,Y)
Third Method: Here we put a domain and multiple range. But in this case I will create one graph for each range and
finally create a multigraph using hold on. Example: X= -10:0.5:10;
Y1=sin(X).*cos(X);
plot(X,Y1)
Y2=2+3*X;
plot(X,Y2)
hold on
plot (X,Y1)
Subgraph: A subgraph is, multiple graphs positioned separately within a graphical window. First of all, here we put one
domain for one range. Then positioned the plot. After that we draw the plot. This process will be continue for multiple
range to create multiple graph in a single graphical window. Example:
Example:X1=-10:0.5:10;
Y1=exp (X1);
subplot(2,2,1)
plot(X1,Y1)
X2= 10:2:90;
Y2= sin(X2).*cos(X2);
subplot(2,2,4)
plot(X2,Y2)

Result:
Discussion: Because MATLAB are case sensitive, so commands must be used correctly.
Conclusion: A single graph can explain many information. By using multigraph we can represent a lot of data. Using
the above method we can create multigraph and subgraph.

You might also like