chan演算法
① 我想用matlab進行CHAN演算法模擬,求程序
function X = Chan_3BS(MSP,R,Noise)
% Chan 演算法,利用3BS對MS進行定位;
% CHAN_3BS:
% 參數說明:
% Noise: 測距誤差方差.
% R: 小區半徑.
% Also see: Chan_3BS.
% 參數檢測:
if nargout ~=1,
error('Too many output arguments!');
end
if nargin ~= 3,
error('input arguments error!');
end
% 演算法開始
MS = R*MSP;
BS = R*NetworkTop(3);
% A矩陣:
X21 = BS(1,2) - BS(1,1);
X31 = BS(1,3) - BS(1,1);
Y21 = BS(2,2) - BS(2,1);
Y31 = BS(2,3) - BS(2,1);
A = inv([X21,Y21;X31,Y31]);
% B矩陣:
R1 = sqrt((BS(1,1) - MS(1))^2 + (BS(2,1) - MS(2))^2);
R2 = sqrt((BS(1,2) - MS(1))^2 + (BS(2,2) - MS(2))^2);
R3 = sqrt((BS(1,3) - MS(1))^2 + (BS(2,3) - MS(2))^2);
R21 = R2 - R1 + MeaNoise(Noise); % 需要加雜訊
R31 = R3 - R1 + MeaNoise(Noise);
B = [R21;R31];
% C矩陣:
K1 = BS(1,1)^2 + BS(2,1)^2;
K2 = BS(1,2)^2 + BS(2,2)^2;
K3 = BS(1,3)^2 + BS(2,3)^2;
C = 0.5*[R21^2 - K2 + K1; R31^2 - K3 + K1];
% 一元二次方程的系數:
a = B'*A'*A*B - 1;
b = B'*A'*A*C + C'*A'*A*B;
c = C'*A'*A*C;
% 方程的兩個根:
root1 = abs((-b + sqrt(b^2 - 4*a*c))/(2*a));
root2 = abs((-b - sqrt(b^2 - 4*a*c))/(2*a));
% 檢驗方程的根:
if root1 < R,
EMS = -A*(B*root1 + C);
else
EMS = -A*(B*root2 + C);
end
% 輸出結果:
if nargout == 1,
X = EMS;
else
disp(EMS);
end
② chan綆楁硶鏄浠涔堟剰鎬濓紵
浠涔堟槸chan綆楁硶錛熺畝鍗曟潵璇達紝瀹冩槸涓縐嶈В鍐沖嚫鍖呴棶棰樼殑綆楁硶銆傚嚫鍖呴棶棰樻槸璁$畻涓緇勭偣鐨勬渶灝忓嚫鍖呯殑闂棰橈紝鑰宑han綆楁硶鍒欐槸鍦ㄨ$畻鍑稿寘鏃訛紝浼樺寲浼犵粺鐨凣raham綆楁硶鍜孞arvis綆楁硶鐨勬晥鐜囧拰鎴愭湰銆傞氳繃灝嗙偣鐨勯泦鍚堝垎鎴愬皬鐨勫瓙闆嗭紝騫跺埄鐢ㄩ儴鍒嗙粨鏋滄潵璁$畻鍑稿寘錛宑han綆楁硶鑳藉湪鏇寸煭鐨勬椂闂村唴瀹屾垚榪欓」浠誨姟銆
chan綆楁硶鐨勫師鐞嗘槸浠涔堬紵
chan綆楁硶鏄濡備綍璇嗗埆鍑稿寘鐨勶紵瀹冨熀浜庣敱涓や釜瀛愰棶棰樼粍鎴愮殑濂楄礬錛氭壘鍒扮偣闆嗙殑鏈灝忓嚫鍖咃紝騫跺皢鐐瑰垝鍒嗕負灝忛儴鍒嗐傞氳繃鎵懼埌姣忎釜瀛愰泦鐨勭Щ浜ょ偣錛宑han綆楁硶鑳藉熻$畻鍑烘暣涓鐐歸泦鐨勫嚫鍖呫傞殢鐫闂棰樼殑鍙樺緱鏇村姞澶嶆潅錛宑han綆楁硶鐨勮繍琛岄熷害浠嶇劧闈炲父楂橈紝榪欐槸鐢卞叾鍒涙柊鎬濈淮銆佸叿鏈夎嚜閫傚簲瑙e喅鏂規堝拰鍒嗚屾不涔嬬殑鏂規硶鎵鍐沖畾鐨勩
chan綆楁硶鍦ㄨ稿氶嗗煙閮芥湁騫挎硾鐨勫簲鐢ㄣ備緥濡傦紝瀹冨彲鐢ㄤ簬CAD杞浠朵腑鐨勫嚑浣曟暟鎹搴擄紝涔熷彲鐢ㄤ簬鍏ㄦ伅鎴愬儚鍜岀嚎鎬ц勫垝鐨勬ц兘浼樺寲銆俢han綆楁硶榪樻槸鍏朵粬綆楁硶鐨勫熀紜錛屽備駭鐢2D鍗婇忔槑瀵硅薄錛堝傞紶鏍囨寚閽堬級錛屼互鍙婃父鎴忓紑鍙戜腑鐨勭版挒媯嫻嬨傛棤璁虹敤浜庡摢縐嶅簲鐢錛宑han綆楁硶閮芥槸鍏堣繘涓旈珮鏁堢殑瑙e喅鏂規堬紝鍙浠ヤ負璁$畻鏈虹戝﹀拰紱繪暎鏁板﹂嗗煙鐨勫墠娌跨爺絀跺仛鍑洪噸瑕佽礎鐚銆