Attempted to access A(5); index out of bounds because numel(A)=4.
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Stelios Fanourakis
il 17 Set 2017
Risposto: Stelios Fanourakis
il 17 Set 2017
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;
P=eye(2);
for i=1:N %kalman predict m(i) = A(i)*X(i) P(i) = A(i) * P(i) * A(i)' + Q(i); end
0 Commenti
Risposta accettata
Image Analyst
il 17 Set 2017
A is a 2-D array of size 2-by-2, so what you you expect to happen when you use only one index, i, into it? And since it has only 4 elements, what do you expect should happen if you send in i of 5 up to 100 into it? What is the 100'th element of A, which has only 4 elements?
0 Commenti
Più risposte (1)
Vedere anche
Categorie
Scopri di più su Creating and Concatenating Matrices in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!