我正在尝试绘制菲涅耳椭圆和两点(x1,y1)和(x2,y2)之间的线。此外,我正在尝试使用 atan2 旋转椭圆。首先,我不明白为什么绘制的红色轴与椭圆的想象主轴不同。它们具有不同的角度和长度。其次,我不确定我是否使用正确的公式来绘制带旋转的椭圆。
f=217.25;
Ht=45;
Hr=2.5;
figure (10);
x1=0;
x2=2.415512976422468e+04;
y1=2.609242854399548e+02+Ht;% Ht is trasmitter antenna height
y2=40.819199999995895+Hr;% Hr is receiver antenna height
% plot line of sight (major axis of ellipse)
hold on,plot([x1 x2],[y1 y2],'r')
% Plot 1st Fresnel zone - ELLIPSE
fr=f*1e6;% f in Hz
c=2.997925e8;% speed of light in m/s
lambda=c/fr; % wavelength in meters
a = 1/2*sqrt((x2-x1)^2+(y2-y1)^2); %majoraxis/2
r = sqrt(lambda*a/2);% b=r %secondaxis/2
t = linspace(0,2*pi,300);
X = a*cos(t);
Y = r*sin(t);
w = atan2(y2-y1,x2-x1); %angle of two points
x = (x1+x2)/2 + X*cos(w) - Y*sin(w);
y = (y1+y2)/2 + X*sin(w) + Y*cos(w);
hold on, plot(x,y,'-k')
grid on