How to index index in the third dimension?

1 visualización (últimos 30 días)
GTA
GTA el 23 de Nov. de 2018
To debug the code in a simpler way it would also be good if I saved all the information as tensors, that is, putting the index "s" in the third dimension and leaving the others free. With this, I want to see all the sigma points, estimated variances, etc. How could you carry out this process? The following is part of the code where I want to apply this indexing.
x(:,1) = [208701300 326*10e6 217*10e6 44000000 22000000 lambdah]';
P(:,:,1) = 1e6*eye(6);
n = 6;
m = 3;
steps=38;
fXis = zeros(n, 2*n+1);
hXis = zeros(m, 2*n+1);
x_pred(:,1) = x;
P_pred(:,:,1) = P;
Pxz(:,:,2*n+1) = zeros(n, m);
for s=2:steps
[Xis, W] = SigmaPoints(x_pred(:,s-1),P_pred(:,:,s-1),1);
for k = 1:2*n+1
fXis(:, k) = f(Xis(:,k));
end
[xp, Pp] = UT(fXis, W, Q);
for k = 1:2*n+1
hXis(:, k) = h(Xis(:,k));
end
[zp, Pz(:,:,s)] = UT(hXis, W, R);
Pxz(:,:,s)=0;
for k = 1:2*n+1
Pxz(:,:,s) = Pxz(:,:,s)+ W(k)*((fXis(:,k) - xp)*(hXis(:,k) - zp)');
end
K(:,:,s) = Pxz(:,:,s)/Pz(:,:,s);
x_pred(:,:,s)= xp + K(:,:,s)*(y_total(s,:)' - zp);
P_pred(:,:,s)= Pp - K(:,:,s)*Pz(:,:,s)*K(:,:,s)';
end
Many thanks for any help!

Respuestas (0)

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by