フィルターのクリア

how to draw circle with different radii in scatter plot?

21 ビュー (過去 30 日間)
Darshan Patel
Darshan Patel 2016 年 3 月 30 日
コメント済み: Darshan Patel 2016 年 3 月 30 日
I am having three points on scatter plot. taking that point as centre of three circle and draw circles that intercepts each other. please help me its urgent

回答 (2 件)

Walter Roberson
Walter Roberson 2016 年 3 月 30 日
See viscircles() instead if you have a newer version of the Image Processing toolkit. Otherwise,
scatter(x(:), y(:), radii(:).^2)
Actually, converting radii to particular size on the screen is more complicated than that, especially if you need something that stays stable when you resize. Markers in scatter plot are designed to stay the same size when you resize the figure. scatter() really isn't suited for what you are doing. Use viscircles instead. Or rectangle()

Roger Stafford
Roger Stafford 2016 年 3 月 30 日
Let P1 = [x1,y1], P2 = (x2,y2), and P3 = [x3,y3] be your three points. Then, interpreting your word 'intercepts' as meaning that the circles should be tangent to one another, do this:
a = norm(P2-P3); b = norm(P3-P1); c = norm(P1-P2);
r1 = (b+c-a)/2; r2 = (c+a-b)/2; r3 = (a+b-c)/2; % <-- This produces tangency
t = linspace(0,2*pi,500);
X1 = P1(1)+r1*cos(t); Y1 = P1(2)+r1*sin(t);
X2 = P2(1)+r2*cos(t); Y2 = P2(2)+r2*sin(t);
X3 = P3(1)+r3*cos(t); Y3 = P3(2)+r3*sin(t);
plot(X1,Y1,'y-',X2,Y2,'r-',X3,Y3,'b-', ...
P1(1),P1(2),'yo',P2(1),P2(2),'ro',P3(1),P3(2),'bo')
axis equal
  3 件のコメント
Roger Stafford
Roger Stafford 2016 年 3 月 30 日
The a, b, and c quantities are the three distances between the points. The formulas you see for r1, r2, and r3 are the necessary radii that will make all three circles of those respective radii tangent to one another. For example, r1+r2 is equal to c which is just the distance between points P1 and P2, thus producing tangency in the two circles about these two points. The remaining lines of code are a standard way of plotting circles with given centers and radii.
If you want the circles to intersect in more than a single point of tangency, then you need to increase each of these radii. It's up to you how much you want such an increase to be.
Darshan Patel
Darshan Patel 2016 年 3 月 30 日
thank you Roger but i am new to matlab see i am havnig latitudes and longitudes of some places that are L1: 52.1344,-106.648 L2: 37.0001,-122.063 L3: 33.6841,-112.099
now i want to convert them to corresponding x and y coordinate and plot circles with these canters and also implement a concept of trilateration please help its very urgent for me.... thanking you

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeContour Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by