Finding 8 points on an ellipse
5 ビュー (過去 30 日間)
古いコメントを表示
Dear experts,
I have created a 95% confidence ellipse using the following code around a dataset:
allX = score(:,1);
allY = score(:,2);
p = 95;
CIx = prctile(allX, [(100-p)/2, p+(100-p)/2]);
CIy = prctile(allY, [(100-p)/2, p+(100-p)/2]);
CIrng(1) = CIx(2)-CIx(1);
CIrng(2) = CIy(2)-CIy(1);
llc = [CIx(1),CIy(1)];
rectangle('Position',[llc,CIrng],'Curvature',[1,1], 'EdgeColor',"red");
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/743744/image.png)
Now I need to find 8 specific points on the ellipse. Points W - Z have to be the lowest, highest, most right and most left of the ellipse (as you can see here (those are normally not the problem, i think you don´t have to help me with these four points):
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/743749/image.png)
The points A-D are more of a problem for me. How can I find these? They are somehow the corners of the rectangle so the corners of the ellipse, but how do I find the coordinates of those?
Thanks in advance.
4 件のコメント
採用された回答
Walter Roberson
2021 年 9 月 20 日
When the ellipse is parameterized as
then the area for the angle from 0 to θ is ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/743934/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/743929/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/743934/image.png)
And the total area of an ellipse of this form is
. We want a sector that is half of the upper quadrant. The upper quadrant by itself would have an area of
. So we want
. Factoring out the
and a 1/2 from both sides then we have
and so
. So
and then
. But tan pi/4 is 1, so ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/743979/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/743939/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/743944/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/743949/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/743954/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/743959/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/743964/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/743969/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/743974/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/743979/image.png)
Checking with (say) a = 5, b = 2, then
. Compute 1/2 * a * b * atan(5/2*tan(atan(2/5))) = 1/2 * 5 * 2 * atan(5/2 * 2/5) = 5 * atan(1) = 5 * pi/4 . And on the left side, 1/2 * pi/4 * 5 * 2 = 5 * pi/4 .
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/743984/image.png)
So the formula for theta turns out to be very simple: atan2(b,a)
Now you just have to transform CIrng into a, b parameters.
0 件のコメント
その他の回答 (1 件)
KSSV
2021 年 9 月 20 日
Find the major, minor axes of ellipse i.e. (a,b). Once these are known, the paraetric equation of ellipse are:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/743754/image.png)
Take phi = 0:pi/4:2*pi ;
You have the points you want.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!