How to compute Expectation in MatLab?
41 ビュー (過去 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!