How to draw a rotated ellipse without any toolbox?
이전 댓글 표시
I need to draw rotated ellipse on a Gaussian distribution plot by surf. I am using a student version MATLAB. Can i still draw a ellipse center at estimated value without any toolbox that required money to buy. I search on internet somebody write ellipse function and allow to download. Are they work well on surf plot.
채택된 답변
추가 답변 (1개)
Oleksii Sidorov
2018년 2월 26일
My version with general parametric equation of rotated ellipse, where 'theta' is angle of CCW rotation from X axis (center at (x0, y0))
t = linspace(0,2*pi,100);
theta = deg2rad(105);
a=2;
b=1;
x0 = 0.15;
y0 = 0.30;
x = x0 + a*cos(t)*cos(theta) - b*sin(t)*sin(theta);
y = y0 + b*sin(t)*cos(theta) + a*cos(t)*sin(theta);
figure;
plot(x,y);
axis equal;
댓글 수: 2
Gabriel Hernandez
2019년 12월 9일
Your code worked perfectly for me, much better than the one from the accepted answer. Thank you!
Vivek Bhartiya
2020년 3월 30일
Fantastic work. It was quite hard to find a functional code.
카테고리
도움말 센터 및 File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!