필터 지우기
필터 지우기

How to draw irregular curve using random data ?

조회 수: 3 (최근 30일)
Kushagra Kirtiman
Kushagra Kirtiman 2022년 7월 23일
댓글: Matt J 2022년 7월 23일
How to draw irregular Circle/ Curve in MATLAB with radius(i.e 5) varying from +- 1
For example I have to make something like this

채택된 답변

Matt J
Matt J 2022년 7월 23일
편집: Matt J 2022년 7월 23일
t=pi/180*(0:10:360);
r=5+0.5*(rand(size(t))*2-1);
r(end)=r(1);
tq=linspace(t(1),t(end),1000);
rq=spline(t,[0,r,0],tq);
[x,y]=pol2cart(tq, rq);
plot(x,y); axis equal
  댓글 수: 2
Kushagra Kirtiman
Kushagra Kirtiman 2022년 7월 23일
Can you please give me a brief explanation so that I can understand it?
Matt J
Matt J 2022년 7월 23일
It starts with polar coordinates t,r where r =5 +/- random perturbation.
Then spline() is used to interpolate smoothly between them.
Then pol2cart() is used to convert to Cartesian x,y coordinates which are plotted as usual.

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by