フィルターのクリア

Info

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

Hi everyone! I need your help.

4 ビュー (過去 30 日間)
Engdaw Chane
Engdaw Chane 2018 年 4 月 7 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
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 件のコメント
Image Analyst
Image Analyst 2018 年 4 月 7 日
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?

回答 (1 件)

KALYAN ACHARJYA
KALYAN ACHARJYA 2018 年 4 月 7 日
%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 件のコメント
Engdaw Chane
Engdaw Chane 2018 年 4 月 7 日
KALYAN, Thank you. I want the result in a matrix. but here the result is just an element.

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by