×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Two graphs in one picture
2

Two graphs in one picture

Two graphs in one picture

(OP)
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?

RE: Two graphs in one picture

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)

RE: Two graphs in one picture

(OP)
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

RE: Two graphs in one picture

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.


http://www.mathworks.com/access/helpdesk/help/techdoc/ref/linespec.html


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 www.mathworks.com 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

RE: Two graphs in one picture

(OP)
brokensoul, it helps a lot. But tell me - is there a way to coloring the graph with ezplot command?

RE: Two graphs in one picture

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');

RE: Two graphs in one picture

(OP)
The best! Thanks a lot!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources