Standard equation:
x2a2+y2b2=1\frac{x^2}{a^2}+\frac{y^2} {b^2}=1 a2x2+b2y2=1
Parametric equation:
x=acosαy=bsinα\begin{align*} x=acos\alpha \\y=bsin\alpha \end{align*}x=acosαy=bsinα
General form equation:
Ax2+Bxy+Cy2+Dx+Ey+F=0Ax^2+Bxy+Cy^2+Dx+Ey+F=0Ax2+Bxy+Cy2+Dx+Ey+F=0
thereinto
A=a2sin2θ+b2cos2θB=2(b2−a2)sinθcosθC=a2cos2θ+b2sin2θD=−2Ax0−By0E=−Bx0−2Cy0F=−12(Dx0+Ey0)−a2b2\begin{align*} A = a^2sin^2\theta+b^2cos^2\theta \\B=2(b^2-a^2) sin\theta cos\theta \\C=a^2cos^2\theta +b^2sin^2\theta \\D=-2Ax_0-By_0 \\E=-Bx_0-2Cy_0 \\F=-\frac{1}{2}(Dx_0+Ey_0)-a^2b^2 \end{align*}A=a2sin2θ+b2cos2θB=2(b2−a2)sinθcosθC=a2cos2θ+b2sin2θD=−2Ax0−By0E=−Bx0−2Cy0F=−21(Dx0+Ey0)−a2b2
x0,y0x_0,y_0x0,y0为椭圆圆心坐标,a,ba,ba,b分别为椭圆的长短半轴,θ\thetaθ为长半轴与x轴的夹角。
l=a∫θ1θ21−e2sin2θ,θ1,θ2∈[0,π2]l=a\int_{\theta_1}^{\theta_2}\sqrt{1-e^2sin^2\theta} ,\theta_1,\theta_2\in[0,\frac{\pi}{2}]l=a∫θ1θ21−e2sin2θ,θ1,θ2∈[0,2π]
thereinto, e=1−b2a2e=\sqrt{1-\frac{b^2}{a^2}}e=1−a2b2. Here, the angle we talk about is in the first quadrant.
C=4lC=4lC=4l
Using the Taylor series expansion, the circumference of the ellipse is
C≈π(a+b)C\approx\pi(a+b) C≈π(a+b)
x232+y222=1\frac{x^2}{3^2}+\frac{y^2}{2^2}=132x2+22y2=1
// 参数方程
theta = 0:0.01:2*pi %起止角度和步长
X = 3*cos(theta)
Y = 2*sin(theta)
plot(X,Y)
绘图输出显示🦢:
// 标准形式
theta = 0:0.01:2*pi
f =@(X,Y)X.^2/9+Y.^2/4-1
plot(X,Y)
绘图输出显示🦏:
// An highlighted block% 参数设定
a = 3
b = 2
e = sqrt(1-b^2/a^2)theta_1 = 0 %起始角度
theta_2 = pi/2 %终止角度
theta_x = theta_1:0.01:theta_2 % 被积区间y= a * sqrt(1-e.^2*sin(theta_x).^2) % 直接以被积函数声明
syms theta_vx
y2=@(theta_vx)a * sqrt(1-e.^2*sin(theta_vx).^2) % 匿名函数,被积函数句柄trapz(theta_x,y) % 梯度积分,trapz(X,Y)根据X指定的坐标或标量间距对Y进行积分,因椭圆第一象限曲线为凸曲线,则梯度法计算结果略小于精确值
quadgk(y2,theta_1,theta_2) % 高斯-勒让德积分,使用高阶全局自适应积分和默认误差容限在区间内对函数句柄求积分
integral(y2,theta_1,theta_2) % 数值积分,使用全局自适应积分和模型误差容限在区间内以数值形式为函数求积分
运行结果🐳:
另,[0,π2][0, \frac{\pi}{2}][0,2π]区间四分之一椭圆弧长不精确计算结果:
ans=π∗(a+b)/4=3.1415∗(2+3)/4=3.9268ans=\pi*(a+b)/4=3.1415*(2+3)/4=3.9268ans=π∗(a+b)/4=3.1415∗(2+3)/4=3.9268
相同角度范围,椭圆弧长结果对比:
----------🌴----------[π4,π2][\frac{\pi}{4},\frac{\pi}{2}][4π,2π]间距下,
----------🌴----------[0,π4][0,\frac{\pi}{4}][0,4π]间距下,