回覆列表
  • 1 # 使用者9101195118007

    如圖所示,至少需要4顆衛星的資料,知道這4顆衛星離目標點的距離數值,然後receiver表示使用者手持GPS的位置;可得方程組:

    以下是matlab程式碼解上述方程組:

    clear all;

    clc;

    load "D:\Desktop\local_1\local_Mat\location.txt";

    c = 3*10^8;

    pointAt = [0;0;0;0];

    for u=1:6

    lenAt = 1:8;

    for k = 1:8

    lenAt(k) = sqrt((location(k,2)-pointAt(1))^2 + (location(k,3)-pointAt(2))^2 + (location(k,4)-pointAt(3))^2 ) + c*pointAt(4);

    end

    lenAt = lenAt";

    detlen = location(:,1) - lenAt;

    A = zeros(8,4);

    for k=1:8

    A(k,1) = -(location(k,2)-pointAt(1))/(location(k,1)-c*pointAt(4));

    A(k,2) = -(location(k,3)-pointAt(2))/(location(k,1)-c*pointAt(4));

    A(k,3) = -(location(k,4)-pointAt(3))/(location(k,1)-c*pointAt(4));

    A(k,4) = c;

    end

    detpoint = (A"*A)\A"*detlen;

    pointAt = detpoint + pointAt;

    % disp(pointAt);

    end

    disp("the ans is:");

    disp(pointAt);

    透過這個方法可以計算不止4顆衛星的資料的GPS位置,多餘的幾個資料可以減小GPS的測量誤差。

  • 中秋節和大豐收的關聯?
  • 上聯:蝶舞蜂飛好時節,如何對下聯?