本章讲的是用matlab实现第一类椭圆积分算法,我们这里用了一个椭圆的标准式作为例子。代码如下
clc
clear
syms theta;
a=5;
b=3;
c=sqrt(a^2-b^2);
e=c/a;
p=abs(a^2/c-c)
result=int(e*p/(1-e*cos(theta)),0,2*pi)/2/pi
theta_div=0:0.01:2*pi;
r_div=e*p./(1-e*cos(theta_div));
plot(theta_div,r_div)
hold on;
plot(theta_div,result)
% hold off;
% ezplot('x^2/(53^2)+ y^2/(3^2) = 1',[-53 53 -3 3])
a^2等于25
b^2等于9
c等a^2-b^2再开根号
运行结果如下