Filter löschen
Filter löschen

Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

Hi everyone! I need your help.

4 Ansichten (letzte 30 Tage)
Engdaw Chane
Engdaw Chane am 7 Apr. 2018
Geschlossen: MATLAB Answer Bot am 20 Aug. 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 Kommentar
Image Analyst
Image Analyst am 7 Apr. 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?

Antworten (1)

KALYAN ACHARJYA
KALYAN ACHARJYA am 7 Apr. 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 Kommentar
Engdaw Chane
Engdaw Chane am 7 Apr. 2018
KALYAN, Thank you. I want the result in a matrix. but here the result is just an element.

Diese Frage ist geschlossen.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by