Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Two graphs in one picture 2

Status
Not open for further replies.

Rodrigo245

Computer
Joined
Aug 6, 2006
Messages
9
Location
SI
Is it possible to draw two graphs in one picture?

For example: I have inequation:

abs(x^2 + 3x + 2) < abs(x^3 + 1)


I know how to draw one graph at once:

y = abs(x^2 + 3*x + 2)

ezplot(y)

y1 = abs(x^3 + 1)

ezplot(y1)


But I would like to draw both graph on the same picture, so I can compare the results. Is this possible?
 
Rodrigo,

Try this... It works in Matlab 7.0 and i am hopeing that the 'hold'command exists in yor version as well.

y = abs(x^2 + 3*x + 2)
y1 = abs(x^3 + 1)
ezplot(y)
hold
ezplot(y1)
 
Brokensoul

thanks a lot for your answer. Do you know also how to change the colour of the graph so I can have one graph for example red and the other blue?


Greetings,

Frenky
 
Frenky,

In future posts tell people what the version number and the name of the software is. And perhaps if you are having a module issue tell which module you are using so people know how to approach your question.


This is a chunk of the help files that should be included in you matlab software. I am not sure but i bet maple had similar files.




the website above should of shown you linespec which are all the modifiers that you can use in plot() or line() or similar commands.

If you have further questions about functions and thier uses. I would go to and use thier reference pages to see if it can answer your question first before coming on to this forum.

I hope this helps....

BSK
 
brokensoul, it helps a lot. But tell me - is there a way to coloring the graph with ezplot command?
 
A quick look at the help page for ezplot shows that you can return handles to your plotted objects: h=ezplot(..

Give the handles, anything is possible. Changing the colour is a doddle. For example:

h=ezplot('cos(x)');
set(h,'color','red');
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top