看板 Programming 關於我們 聯絡資訊
下面是一個自由落體的模型,結合卡爾曼濾波器。 我先講解一下,以下是kalman-filter五條公式 https://imgur.com/a/85OkG https://imgur.com/a/kCCjz 然後,在下面這2張圖,是把參數代入之後的情況(或許可以作為參考) https://imgur.com/a/kTSfpfS (迭代 第一次) https://imgur.com/a/3aGo1km (迭代 第二次) 然後各參數我都有,就只是代入就好....只是我最後面有一行程式碼看不懂=.= 以下是code碼: % Kalman filter for the example of free body falling % Using previous data to modified clear all clc II=eye(2,2); N=15; %y0=[100 99.5 98.0 95.5 92.0 87.5 82.0] %y =[0 100 97.9 94.4 92.7 87.3 82.1] y0=[100 99.5 98.0 95.5 92.0 87.5 82.0 75.5 68.0 59.5 50.5 39.5 28.0 15.5 2.0] y= [100 100.0 97.9 94.4 92.7 87.3 82.1 75.4 68.8 59.0 50.6 39.4 28.3 14.5 2.1] A=[1 1 0 1] U=[-0.5 -1.0] H=[1 0] R=1 x=zeros(2,1,N); % N代表"次數",此程式N為15。表示迭代了15次。 x(:,1,1)=[95 1]; x0=zeros(1,N) p=zeros(2,2,N); p(:,:,1)=[10 0 0 1]; kg=zeros(2,1); for k=2:N x(:,1,k) = A*x(:,1,k-1)+U; p(:,:,k) = A*p(:,:,k-1)*A'; kg(:,1,k) = p(:,:,k)*H' / (H*p(:,:,k)*H'+R); x(:,1,k)=x(:,1,k)+kg(:,1,k)*(y(k-1)-H*x(:,1,k-1)); x0(1,k)=x(1,1,k); p(:,:,k)=(II-kg(:,1,k)*H)*p(:,:,k);; end y0 y x0 t=1:N; plot(t,y0,'r',t,y,'g',t,x0,'b'); ================================================= 我想問的是,這一行程式碼 x0(1,k)=x(1,1,k); 的涵義是?? ※ 發信站: 批踢踢實業坊(ptt.cc) ※ 轉錄者: Ecampus (125.230.88.172), 05/03/2018 18:32:53 ※ 編輯: Ecampus (125.230.88.172), 05/03/2018 18:33:19 ※ 編輯: Ecampus (125.230.88.172), 05/03/2018 19:06:08 ※ 編輯: Ecampus (125.230.88.172), 05/03/2018 19:08:01
chuegou: 這是...malab? 111.241.158.52 05/04 01:38
circums: 他是為了畫圖方便所以把起始點給另外存出 42.76.73.217 05/04 17:43
circums: 來嗎?! 42.76.73.217 05/04 17:43
asglay: x0沒有在迭代過程 所以不影響x值的更新 114.39.16.196 05/05 05:01
asglay: 但我覺得迭代更新數值的過程怪怪的 建議躬 114.39.16.196 05/05 05:05
asglay: 參考wiki的說明 https://bit.ly/2rneZaU 114.39.16.196 05/05 05:06
Ecampus: 剛發現 他的意思了XD 我等一下在下面解釋 125.230.89.91 05/05 21:23
Ecampus: 給大家聽XD 125.230.89.91 05/05 21:23