设两焦点分别为e1,e2,一个动点M满足到e1,e2的距离差为常数,即
∣∣Me1∣−∣Me2∣∣=d
该动点的轨迹为双曲线。
该文章使用MATLAB中的ezplot()函数绘制参数方程的曲线,在其帮助文档里,对含参方程的绘制方法说明如下:
If your function has additional parameters, for example k in myfun:
function z = myfun(x,y,k)
z = x.^k - y.^k - 1;
then you can use an anonymous function to specify that parameter:
ezplot(@(x,y)myfun(x,y,2))
myplot(-3,0,3,0,1)
myplot(-3,0,4,5,1.5)
myplot(-3,0,2,10,3)
function myplot(x1,y1,x2,y2,d) %(x1,y1),(x2,y2)为焦点,d为距离差
function z = myfun(x,y,x1,y1,x2,y2,d)
z =abs (sqrt((x-x1)^2+(y-y1)^2)-sqrt((x-x2)^2+(y-y2)^2))-d;
end
h = ezplot(@(x,y)myfun(x,y,x1,y1,x2,y2,d)); %myfun()中,x1,y1,x2,y2,d为参数
set(h,'Color',[rand(),rand(),rand()])
hold on
end
如图: