Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Hi everyone! I need your help.

4 visualizaciones (últimos 30 días)
Engdaw Chane
Engdaw Chane el 7 de Abr. de 2018
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
I have a 3D matrix, X which is 83x92x80. What I need to do is the following:
I tried
% code
%
for n=1:size(X, 3);
for j=3:n;
ss=sum((X (j-1)) .*( X (j-2)) ./ ((n-1) .* (n-2))) ./ 80;
end
end
The result I expect is matrix.
Thank you Chane
  1 comentario
Image Analyst
Image Analyst el 7 de Abr. de 2018
I'm not sure why you're using n as a loop iterator. I see nothing that says n should be a loop iterator. It looks like n should be a constant as far as I can see. It looks like the looping is only over the j variable, not n.
I also don't know what "x sub j" means. Is that the jth element of a vector x? Do you have multiple variables with different names, like x3, x4, x5, x6, ... xn?
And I don't know what the square brackets mean. Do they enclose indexes? Like xj[(j-1)*(j-2)] would be the row of xj that [(j-1)*(j-2)] evaluates to? Or are you taking the array xj (say x3 or x4 or whatever) and multiplying by the scalar [(j-1)*(j-2)] and dividing by the scalar [(n-1)*(n-2)]? It's tough to tell when you're not using standard MATLAB syntax.
So let's say j is 3 and n is 20. Is the sum x20 * [(3-1)*(3-2)] / [(20-1)*(20-2)], which equals x20 * [2*1] / [19*18] which equals x20 * 2/342?

Respuestas (1)

KALYAN ACHARJYA
KALYAN ACHARJYA el 7 de Abr. de 2018
%There is no error,
%X=input Matrix
for n=1:size(X, 3);
for j=3:n;
ss=sum((X (j-1)).*( X (j-2))./ ((n-1) .* (n-2)))./ 80;
end
end
  1 comentario
Engdaw Chane
Engdaw Chane el 7 de Abr. de 2018
KALYAN, Thank you. I want the result in a matrix. but here the result is just an element.

La pregunta está cerrada.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by