Info

この質問は閉じられています。 編集または回答するには再度開いてください。

In an assignment A(I) = B, the number of elements in B and I must be the same.

1 回表示 (過去 30 日間)
Stelios Fanourakis
Stelios Fanourakis 2017 年 9 月 17 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
What Is this error?
  1 件のコメント
Stelios Fanourakis
Stelios Fanourakis 2017 年 9 月 17 日
clc;
N = 100;
w = 0.5;
q = 0.01;
r = 0.1;
%%This is the transition matrix
A = [cos(w) sin(w)/w;
-w*sin(w) cos(w)];
%%This is the process noise covariance
Q = [0.5*q*(w-cos(w)*sin(w))/w^3 0.5*q*sin(w)^2/w^2;
0.5*q*sin(w)^2/w^2 0.5*q*(w+cos(w)*sin(w))/w];
% This is the true initial value
x0 = [0;0.1];
X = zeros(2,N); % The true signal
Y = zeros(1,N); % Measurements
T = 1:N; % Time
x = x0;
for i=1:N %kalman predict x(i) = A*x P(i) = A * P * A' + Q; end

回答 (1 件)

Image Analyst
Image Analyst 2017 年 9 月 17 日
編集済み: Image Analyst 2017 年 9 月 17 日
For example you're trying to stuff a whole 2-by-7 matrix into an element that can take only one number.
For another example
A = [2,3,4];
B = [3,4,5,6,7,8,9,1,2,3,4,5,6,7]
A(2) = B; % Stuff 14 numbers into a space that only holds one.
So the number of elements and the shape of "I" is not the same as "B". If you can be more specific (like by showing your code), then we'll be able to also.

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by