I just started learning mathlab and I wanted to plot a circle on this figure.. more like a car. please how do i do it.. x=[0,0,1,2,3,4,5,5,0] y=[0,1,1,2,2,1,1,0,0]. Thank you

 채택된 답변

KSSV
KSSV 2015년 11월 13일

1 개 추천

Let the center of circle be (a,b) and radius be 'r'. Use parametric equations of circle.
x = a+r*cos(theta) ; y = b+r*sin(theta) ;
You have to define theta into a array.
use hold on ;
plot(x,y,'r') ;
this will plot circle on the given plot.

추가 답변 (1개)

Image Analyst
Image Analyst 2015년 11월 13일

0 개 추천

Or alternatively you could use rectangle() (believe it or not, see the help), or
plot(x,y,'MarkerSize', 100).

댓글 수: 3

peter obi
peter obi 2015년 11월 13일
what could be the MarkerSize?
Image Analyst
Image Analyst 2015년 11월 13일
It looks like you accepted the Answer from the FAQ. But if you just want to put a circle on a graph, you can do it much simpler with rectangle or plot. Just experiment with different MarkerSizes to get the size you want. Typically if you don't specify it, I think it's something like 8 or so. But if you want larger, use bigger numbers. I just guessed at 100 but you could try 20 or 50 or whatever. It's probably faster because you're not plotting an array of a bunch of points like if you use a parameterized circle.
peter obi
peter obi 2015년 11월 14일
Thank you bro.. worked also..

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

질문:

2015년 11월 13일

댓글:

2015년 11월 14일

Community Treasure Hunt

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

Start Hunting!

Translated by