user2865892
user2865892

Reputation: 21

Multiple graphs in the same window

i have a function that gets few parameters and plots a graph in Matlab i want to use the function to plot few graphs with different parameters in one window. i tried "subplot" but it doesn't do it. is there a way doing it? thanks

Upvotes: 1

Views: 68

Answers (2)

User1551892
User1551892

Reputation: 3384

I would like to add one more thing in C. Colden suggestion, Provide the same x values for all plot as shown below:

x = 0:0.01:pi ;
y1 = sind(x) ;
y2= codd(x) ;
plot (x,y1)
hold on
plot(x,y2)

if you want to provide x1 and x2 for x values, then you will encounter with an error.

Upvotes: 1

C.Colden
C.Colden

Reputation: 627

Use the command hold on and in the end hold off

Further information: http://www.mathworks.ch/ch/help/matlab/ref/hold.html

Upvotes: 2

Related Questions