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

조회 수: 2 (최근 30일)
Jimmy Smith
Jimmy Smith 2015년 3월 30일
답변: Star Strider 2015년 3월 30일
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

답변 (2개)

Youssef  Khmou
Youssef Khmou 2015년 3월 30일
Adding semi column (;) for all instructions inside the function will prevent the printing of values.

Star Strider
Star Strider 2015년 3월 30일
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

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by