フィルターのクリア

Change start point of plot and show all points

13 ビュー (過去 30 日間)
N/A
N/A 2020 年 4 月 25 日
コメント済み: Ameer Hamza 2020 年 4 月 27 日
I write this code for calculating Kalman Gain and show them for 50 iterations on a plot.
I want to get a plot like here in the attachment. I need to show (0,0) and show all the points.
Please, help me :)
clear
clc
P = 1;
R = 0.1;
XK1 =0;
hold on
Z=random('Normal',0,2,1,50);
randn('seed',0)
uzunluk=length(Z);
XK_sakla=[1:uzunluk];
KG_sakla=[1:1:uzunluk];
a=0;
for y = [1:uzunluk]
a=a+1;
KG = P/(P+ R);
XK = XK1 + (KG*(Z(a)-XK1));
P = (1-KG)*P;
XK1 = XK;
XK_sakla(a) = XK;
KG_sakla(a) = KG;
end
plot (1:uzunluk , KG_sakla,'blue','Linewidth',1 );
grid on;
grid minor;
xlabel('Number of Observations');
ylabel('Kalman Gain');

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 4 月 25 日
編集済み: Ameer Hamza 2020 年 4 月 25 日
Change the plot line to this
plot (0:uzunluk , [0 KG_sakla],'b.-','Linewidth',1, 'MarkerSize', 10);
  2 件のコメント
N/A
N/A 2020 年 4 月 27 日
Thank you :)
Ameer Hamza
Ameer Hamza 2020 年 4 月 27 日
Glad to be of help.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by