How to compute Expectation in MatLab?
47 次查看(过去 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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Type Conversion 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!