필터 지우기
필터 지우기

Question Regarding Division Operation

조회 수: 3 (최근 30일)
karthikeyan Reddy Thoomu
karthikeyan Reddy Thoomu 2017년 10월 9일
답변: James Tursa 2017년 10월 9일
Why does a/b gives a 3x3 matrix instead of giving an error for the following example? What Operation is it Performing?
a = [1 2;3 4;5 6] and b = [3 4; 5 6;7 8]
a./b = [0.33 0.5;0.60 0.66;0.7143 0.75] and a/b = [1.5 0 -0.5;1 0 0;0.5 0 0.5]

답변 (1개)

James Tursa
James Tursa 2017년 10월 9일
Using the ./ operator with the dot does element-wise division. Using / without the dot does matrix linear equation solving. So this operation:
x = a/b
is the solution to the following equation
x*b = a
I.e., conceptually you divide both sides of this equation on the right by b to get the solution above. This is simply a set of linear equations that MATLAB is solving using the "backslash" or "forwardslash" operator. E.g.,
>> a = [1 2;3 4;5 6]
a =
1 2
3 4
5 6
>> b = [3 4; 5 6;7 8]
b =
3 4
5 6
7 8
>> x = a/b
x =
1.5000 0 -0.5000
1.0000 0 0
0.5000 0 0.5000
>> x*b
ans =
1.0000 2.0000
3.0000 4.0000
5.0000 6.0000

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by