MATLAB: Last Question of the Night

subplot

% 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. 🙂

Best Answer

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