Why do I get conj(L)

5 ビュー (過去 30 日間)
Ken
Ken 2025 年 3 月 1 日
コメント済み: Walter Roberson 2025 年 3 月 1 日
When I multiply 2 4X4 matrices one numeric the other alpha numeric say with L1,L2,L3, L4 why do I get the answer with cconj(L1,L2,L3,L4)? Also why do I get answers in fractions not decimal?

採用された回答

Star Strider
Star Strider 2025 年 3 月 1 日
The Symbolic Math Toolbox assumes all variables are complex, so it adds the conj to be complete. Specifying that the variables are real in the syms declaration prevents that.
To convert the fractions to decimal fractions, use the vpa function. To always get decimal fractions, use the appropriate options in sympref. .
  1 件のコメント
Walter Roberson
Walter Roberson 2025 年 3 月 1 日
Symbolic Math toolbox does not ordinarily add conj() for matrix multiplication or element-by-element multiplication.

サインインしてコメントする。

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2025 年 3 月 1 日
編集済み: Walter Roberson 2025 年 3 月 1 日
You probably used the ' operator on the symbolic vector. For example,
syms L [1 4]
A = [2 3; 4 5]/7
A = 2×2
0.2857 0.4286 0.5714 0.7143
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
B = [L1 L2; L3 L4]
B = 
C = A*B
C = 
C = A*B'
C = 
whereas you might have wanted
D = A*B.'
D = 
To get the answer in decimal, either use
vpa(D, 10)
ans = 
or else use
sympref('FloatingPointOutput', true)
ans = logical
0
D
D = 

カテゴリ

Help Center および File ExchangeConversion Between Symbolic and Numeric についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by