MATLAB Answers

0

plot ellipses by clicking points?

Kaleesh Bala さんによって質問されました 2018 年 9 月 17 日
最新アクティビティ Kaleesh Bala さんによって コメントされました 2018 年 10 月 17 日
How to plot ellipses by clicking on the points. I have a 100*100 cm grid and I would like to generate ellipses in it by clicking different positions. Is there a way to do it? The ellipses can intersect and thereby I need to detect the high region of intersection.

  5 件のコメント

Kaleesh Bala 2018 年 9 月 17 日
Kaleesh Bala 2018 年 9 月 17 日
whether imellipse or drawellipse works in this case?
Kaleesh Bala 2018 年 9 月 18 日
I believe imellipse is already a preloaded one where one just clicks and drag the ellipse, can it be modified based on the above case?

サインイン to comment.

1 件の回答

KSSV
回答者: KSSV
2018 年 9 月 18 日
編集済み: KSSV
2018 年 9 月 18 日
 採用された回答

figure
hold on
axis equal
t=-pi:0.01:pi;
for i = 1:10
a=10; % horizontal radius
b=5; % vertical radius
[x0,y0] = getpts() ;
x=x0(1)+a*cos(t);
y=y0(1)+b*sin(t);
plot(x,y)
drawnow
end

  7 件のコメント

Kaleesh Bala 2018 年 9 月 18 日
thanks, lemme have a check.Is there any reason for keeping a,b constant. Can't it be like
a = (x0(1)+x0(2))./2;
b = (y0(1)+y0(2))./2;
or do you have other choices?
KSSV
2018 年 9 月 18 日
That is your choice..you should be knowing....they determine the size/ radii of ellispes.
Kaleesh Bala 2018 年 10 月 17 日
Thanks for the comments; this is the overall script created. But the problem is that it's moving away from the boundary. Of course, I know it's based on the radii size as we mention, but is there any way to constrain that within boundary ??
function ellipsedrawon
clear
close uiopen
t=-pi:0.01:pi;
for i = 1:20
%getting the points
[x0,y0] = ginput(2) ;
% a =10;
% b =5;
% a = (x0(1)+x0(2))./2; % horizontal radii
b = (y0(1)+y0(2))./2; % vertical radii
% x,y ellipse plot
x=x0(1)+a*cos(t);
y=y0(1)+b*sin(t);
plot(x,y)
drawnow
end

サインイン to comment.



Translated by