How to draw irregular curve using random data ?
3 ビュー (過去 30 日間)
古いコメントを表示
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![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1074810/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1074810/image.png)
0 件のコメント
採用された回答
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 件のコメント
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 Center および File Exchange で Smoothing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!