📄 pos4.m
字号:
%theta对两站定位精度的影响
clear;clc;
M=10; %被测点数
N=100; %对每点的测量次数
x1=0,y1=0; %第一站坐标
x2=1000,y2=0; %第二站坐标
delta=0.01;
theta1=(2*pi/(3*M))*(1-M/2:M/2);
theta2=-pi/6;
xt=(y2-y1-cot(theta1)*x1+cot(theta2)*x2)./(cot(theta2)-cot(theta1));
yt=(cot(theta2)*y1-cot(theta1)*y2-cot(theta1)*cot(theta2)*(x1-x2))./(cot(theta2)-cot(theta1));
plot(xt,yt,'or');
hold on;
for (i=1:M)
%角度测得值
mtheta1(i,:)=theta1(i)*ones(1,N)+delta*randn(1,N);
mtheta2(i,:)=theta2*ones(1,N)+delta*randn(1,N);
for(j=1:N)
%利用两站进行计算
xe2(i,j)=(y2-y1-cot(mtheta1(i,j))*x1+cot(mtheta2(i,j))*x2)/(cot(mtheta2(i,j))-cot(mtheta1(i,j)));
ye2(i,j)=(cot(mtheta2(i,j))*y1-cot(mtheta1(i,j))*y2-cot(mtheta1(i,j))*cot(mtheta2(i,j))*(x1-x2))/(cot(mtheta2(i,j))-cot(mtheta1(i,j)));
%plot(xe2(i,j),ye2(i,j),'.g');
end
%计算均值和方差,并以均值作为最终测得坐标值
meanposx2(i)=mean(xe2(i,:));
meanposy2(i)=mean(ye2(i,:));
stdposx2(i)=std(xe2(i,:));
stdposy2(i)=std(ye2(i,:));
stdpos2(i)=(stdposx2(i)^2+stdposy2(i)^2)^1/2;
stdpos2r(i)=stdpos2(i)/yt(i);
plot(meanposx2(i),meanposy2(i),'.b');
%axis([0 1500 -3000 3000]);
end
figure;
plot(theta1,stdpos2);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -