Subtracting a Vector from a Scalar-Multiplied Matrix
2 次查看(过去 30 天)
显示 更早的评论
Let's say that we have the following two matrices
and we want to calculate
. We know that it is not defined, but MATLAB gives me the following result.Could anyone explain me why that happens?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1660506/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1660511/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1660516/image.png)
C=[1 2; 2 1]
E=[1;2]
3*C-E
5 个评论
Torsten
2024-4-5
It's just a convention to get rid of the bsxfun - there is nothing to explain (or even justify).
采纳的回答
Steven Lord
2024-4-4
8 个评论
Paul
2024-4-5
Even prior to R2016B, as far back as to the very first release as far as I know, Matlab implemented scalar expansion. Code like this has always worked
eye(2) - 1
even though subtracting a scalar from a matrix is not mathematically rigorous.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!