Ellipse and circle plot

25 Ansichten (letzte 30 Tage)
aa
aa am 14 Sep. 2020
Bearbeitet: KSSV am 14 Sep. 2020
May someone help me here
I want to plot an ellipse with origin at (0,0) and semi major axis 2 in horizontal direction and an eccentricity of 0.4.
on the same figire i want to plot a circel of radius 2 with origin at (0, 0).

Antworten (1)

KSSV
KSSV am 14 Sep. 2020
Bearbeitet: KSSV am 14 Sep. 2020
C = [0 0] ; % center
a = 2 ; % major axis
e = 0.4 ; % eccentricity
b = a*sqrt(1-e^2) ; % minor axis
%
R = 2; % Radius if cricle
th = linspace(0,2*pi) ;
% Ellipse
xe = C(1)+a*cos(th) ;
ye = C(2)+b*sin(th) ;
% Circle
xc = C(1)+R*cos(th) ;
yc = C(2)+R*sin(th) ;
% plot
plot(xe,ye,'b',xc,yc,'r')
axis equal

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by