フィルターのクリア

Inner matrix dimensions must agree error

1 回表示 (過去 30 日間)
Nana Fernandes
Nana Fernandes 2017 年 4 月 14 日
コメント済み: Geoff Hayes 2017 年 4 月 16 日
nlen=28;
a=ones(5601,nlen);
h=ones(5600,nlen);
Q=0.01;
x=ones(5600,nlen);
w1=ones(5600,nlen);
w=w1*sqrt(Q);
x_0=xlsread('D:\ieee14\faultset.xlsx',1,'A5601:AB11201');
x(1)=a*x_0+w(1);
this is my code and i keep getting this error Error using * Inner matrix dimensions must agree. Error in x(1)=a*x_0+w(1);
how to remove it? i want to do matrix multiplication

回答 (1 件)

Geoff Hayes
Geoff Hayes 2017 年 4 月 14 日
Nana - looking at your code, a is a 5601x28 matrix and w is a 5600x28 matrix. The dimensions of x_0 are unknown (from the above code anyway). Your equation is
x(1)=a*x_0+w(1);
Since you are multiplying a with x_0, then the number of rows of x_0 must be identical to the number of columns of a. This means that x_0 must have 28 (i.e. nlen) rows. From the error message, this doesn't appear to be true. What can you tell us about the dimensions of x_0? In your code, add
size(x_0)
Also, since the number of rows of a is one more than the number of rows of w, you will not be able to add the product of a with x_0 since it will have 5601 rows and the w will have 5600.
  6 件のコメント
Nana Fernandes
Nana Fernandes 2017 年 4 月 14 日
編集済み: Nana Fernandes 2017 年 4 月 14 日
also
x{1} = a*x_0+w(1);
along with the changes u said above gives me the error
Cell contents assignment to a non-cell array object.
i even changed 'a' to
a=eye(28,5601);
Geoff Hayes
Geoff Hayes 2017 年 4 月 16 日
Nana - I think that you need to review what it is you want your Kalman filter to do. What are the observations? What is the state vector? What are you trying to model?

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

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by