MATLAB Answers

0

Preventing all [x,y] figures appearing when running a plot of a circle

Jimmy Smith 님이 질문을 제출함. 30 Mar 2015
최근 활동 Star Strider 님이 답변함. 30 Mar 2015
When plotting a circle using x=rcos(theta) and y=rsin(theta), I create a linspace to obtain many values for x and y and then plot [x,y]. However, whenever I run the function, all these values appear. How do I prevent this from happening? This is what top line looks like:
function [x,y] = disc_plot
Thank you

  댓글 수: 0

로그인 to comment.

태그

답변 수: 2

Youssef Khmou 님의 답변 30 Mar 2015

Adding semi column (;) for all instructions inside the function will prevent the printing of values.

  댓글 수: 0

로그인 to comment.


Star Strider 님의 답변 30 Mar 2015

I have no idea what you’re doing.
The correct syntax is:
r = 1;
theta = linspace(0, 2*pi);
x = r*cos(theta);
y = r*sin(theta);
plot(x,y)
grid % Optional
axis equal

  댓글 수: 0

로그인 to comment.



Translated by