Info
この質問は閉じられています。 編集または回答するには再度開いてください。
How to implement the following formula in MATLAB?
1 回表示 (過去 30 日間)
古いコメントを表示
E=summation summation summation v^2(x,y,z)
where x, y and z are the limits of summation respectively. V is a 208x176x176 matrix .
Any help is appreciated. Thanks
0 件のコメント
回答 (2 件)
Rohit Kudva
2015 年 7 月 17 日
Hi,
I am assuming that you want to sum up all elements of 'V^2' where V is a 3D matrix. You can implement it using the sum function as follows:
>> sum(sum(sum(V.^2)));
'V.^2' computes element-wise square for each element in matrix 'V'. The above line of code will return a single scalar value which is the sum of all elements in 'V.^2' 3D matrix. You can replace 'V.^2' in the above line of code by the expression 'V.*V'.
I hope this answers helps you.
- Rohit
0 件のコメント
Image Analyst
2015 年 7 月 17 日
You don't need to call sum() three times. Simply try this:
E = sum(V(:).^2);
0 件のコメント
この質問は閉じられています。
参考
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!