フィルターのクリア

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 Center および File ExchangeMatrices and Arrays についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by