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?
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에서 Get Started with MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!