Last Question of the Night

% Author: Sean Walsh % Write a script that plots r=cos(2theta) from 0 to 2pi. disp('Using MatLabs Polar command we graph') theta=linspace(0,2*pi); r=cos(2*theta); polar(theta,r) disp('Using MatLabs Plot command we graph') x=r.*cos(theta); y=r.*sin(theta); plot(x,y) disp('When subplotted together')
^How does one subplot that? Thank you in advance. :)

2 Comments

Please format your code properly. Thanks.
And of course, use a meaningful subject line, not a useless one like "Last Question of the Night".

Sign in to comment.

 Accepted Answer

subplot(1,2,1)
polar(theta,r);
subplot(1,2,2)
plot(x,y);

More Answers (2)

Sean
Sean on 31 Jan 2013
Thanks :o May I ask how you got there though? I wanna learn too:)

1 Comment

I'm sure it's in the Getting Started guide somewhere. Other than that, there's
>> docsearch subplot
>> doc subplot
>> help subplot

Sign in to comment.

Sean
Sean on 31 Jan 2013
thank you :3

1 Comment

Please post comments as comments and not as answers. Thanks.

Sign in to comment.

Tags

Asked:

on 31 Jan 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!