资源简介

用matlab实现的多站定位系统性能仿真源代码

资源截图

代码片段和文件信息

%两站和三站定位
clear;clc;
M=10;   %被测点数
N=100;  %对每点的测量次数
x1=0y1=0;    %第一站坐标
x2=1000y2=0; %第二站坐标
x3=2000y3=0;   %第三站坐标

delta=0.01;
xt=2000*rand(1M);
yt=2000*rand(1M);
theta1=atan((xt-x1)./(yt-y1));
theta2=atan((xt-x2)./(yt-y2));
theta3=atan((xt-x3)./(yt-y3));
plot(xtyt‘or‘);
hold on;

for (i=1:M)   
%角度测得值  
mtheta1(i:)=theta1(i)*ones(1N)+delta*randn(1N);  
mtheta2(i:)=theta2(i)*ones(1N)+delta*randn(1N);
mtheta3(i:)=theta3(i)*ones(1N)+delta*randn(1N);
for(j=1:N)
%利用两站进行计算
xe2(ij)=(y2-y1-cot(mtheta1(ij))*x1+cot(mtheta2(ij))*x2)/(cot(mtheta2(ij))-cot(mtheta1(ij)));
ye2(ij)=(cot(mtheta2(ij))*y1-cot(mtheta1(ij))*y2-cot(mtheta1(ij))*cot(mtheta2(ij))*(x1-x2))/(cot(mtheta2(ij))-cot(mtheta1(ij)));
%利用三站进行计算
x12(ij)=((y1-y2)*tan(mtheta1(ij)).*tan(mtheta2(ij))+x2*tan(mtheta1(ij))-x1*tan(mtheta2(ij)))/(tan(mtheta1(ij))-tan(mtheta2(ij)));
y12(ij)=(y1*tan(mtheta1(ij))-y2*tan(mtheta2(ij))+(x2-x1))/(tan(mtheta1(ij))-tan(mtheta2(ij)));
x13(ij)=((y1-y3)*tan(mtheta1(ij)).*tan(mtheta3(ij))+x3*tan(mtheta1(ij))-x1*tan(mtheta3(ij)))/(tan(mtheta1(ij))-tan(mtheta3(ij)));
y13(ij)=(y1*tan(mtheta1(ij))-y3*tan(mtheta3(ij))+(x3-x1))/(tan(mtheta1(ij))-tan(mtheta3(ij)));
x23(ij)=((y2-y3)*tan(mtheta2(ij)).*tan(mtheta3(ij))+x3*tan(mtheta2(ij))-x2*tan(mtheta3(ij)))/(tan(mtheta2(ij))-tan(mtheta3(ij)));
y23(ij)=(y2*tan(mtheta2(ij))-y3*tan(mtheta3(ij))+(x3-x2))/(tan(mtheta2(ij))-tan(mtheta3(ij)));
xe3(ij)=(x12(ij)+x13(ij)+x23(ij))/3;
ye3(ij)=(y12(ij)+y13(ij)+y23(ij))/3;
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;
plot(meanposx2(i)meanposy2(i)‘.b‘);
xlabel(‘X‘);
ylabel(‘Y‘);
axis([0 2000 0 2000]);

meanposx3(i)=mean(xe3(i:));
meanposy3(i)=mean(ye3(i:));
stdposx3(i)=std(xe3(i:));
stdposy3(i)=std(ye3(i:));
stdpos3(i)=(stdposx3(i)^2+stdposy3(i)^2)^1/2;
plot(meanposx3(i)meanposy3(i)‘*g‘);
end
figure;
plot(1:Mstdpos2);
hold on;
plot(1:Mstdpos3‘--r‘);
ylabel(‘E‘);

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       1183  2005-12-30 22:49  用matlab实现的多站定位系统性能仿真-us\pos4.m

     文件       2208  2005-12-31 03:46  用matlab实现的多站定位系统性能仿真-us\pos1.m

     文件       1049  2005-12-31 03:46  用matlab实现的多站定位系统性能仿真-us\pos2.m

     文件        941  2005-12-31 00:32  用matlab实现的多站定位系统性能仿真-us\pos3.m

     目录          0  2008-12-20 21:23  用matlab实现的多站定位系统性能仿真-us

----------- ---------  ---------- -----  ----

                 5381                    5


评论

共有 条评论