我想繪製菲涅耳橢圓和兩點(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
我有一個完全錯誤的情節使用軸平等 – kosar