-
大小: 2.93 KB文件類型: .rar金幣: 1下載: 1 次發(fā)布日期: 2024-11-27
- 語(yǔ)言: Matlab
- 標(biāo)簽: 多站定位??系統(tǒng)性能??
資源簡(jiǎn)介
用matlab實(shí)現(xiàn)的多站定位系統(tǒng)性能仿真源代碼
代碼片段和文件信息
%兩站和三站定位
clear;clc;
M=10;???%被測(cè)點(diǎn)數(shù)
N=100;??%對(duì)每點(diǎn)的測(cè)量次數(shù)
x1=0y1=0;????%第一站坐標(biāo)
x2=1000y2=0;?%第二站坐標(biāo)
x3=2000y3=0;???%第三站坐標(biāo)
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)???
%角度測(cè)得值??
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)
%利用兩站進(jìn)行計(jì)算
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)));
%利用三站進(jìn)行計(jì)算
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
%計(jì)算均值和方差,并以均值作為最終測(cè)得坐標(biāo)值
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‘);
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件???????1183??2005-12-30?22:49??用matlab實(shí)現(xiàn)的多站定位系統(tǒng)性能仿真-us\pos4.m
?????文件???????2208??2005-12-31?03:46??用matlab實(shí)現(xiàn)的多站定位系統(tǒng)性能仿真-us\pos1.m
?????文件???????1049??2005-12-31?03:46??用matlab實(shí)現(xiàn)的多站定位系統(tǒng)性能仿真-us\pos2.m
?????文件????????941??2005-12-31?00:32??用matlab實(shí)現(xiàn)的多站定位系統(tǒng)性能仿真-us\pos3.m
?????目錄??????????0??2008-12-20?21:23??用matlab實(shí)現(xiàn)的多站定位系統(tǒng)性能仿真-us
-----------?---------??----------?-----??----
?????????????????5381????????????????????5
評(píng)論
共有 條評(píng)論