How to compute Expectation in MatLab?
조회 수: 40 (최근 30일)
이전 댓글 표시
채택된 답변
Stephen23
2014년 9월 25일
편집: Stephen23
2014년 9월 25일
Many basic operators in MATLAB are treated as matrix operations, including multiplication , division ,and power operators.
When you wish to perform the same operation element-wise, then you can use the element-wise syntax. For example matrix multiplication is A*B, whereas multiplication of corresponding array elements is A.*B .
x.^4
which operates on the whole vector at once. Handy! You might like to read this too:
댓글 수: 0
추가 답변 (1개)
Star Strider
2014년 9월 25일
That is how I would do it, using element-wise exponentiation:
Ex4 = mean(x.^4);
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!