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!