Malfunction to my matrix calculation
4 ビュー (過去 30 日間)
古いコメントを表示
Below here, I want to calculate the matrix of X.
From what I understand, K is a 4x4 matrix, and F is a 1x4 matrix.
In order to get X, I have to transpose my martix F, so it can be a 4x1 matrix.
Therefore, X should be a 4x1 matrix.
The problem here is what I get instead is a 4x4 matrix, which can be shown in the second picture below.
Is there a typo problem or something that I didn't notice about the code?
0 件のコメント
採用された回答
James Tursa
2022 年 10 月 27 日
編集済み: James Tursa
2022 年 10 月 27 日
K .* F (with the dot) does element-wise multiplication with implicit array expansion if the variables are different sizes, thus the 4x4 result.
K * F (without the dot) does matrix multiply and will get a 4x1 result.
E.g.,
K = rand(4,4); % 4x4
F = rand(1,4); % 1x4
K = inv(K); % 4x4
F = F'; % 4x1
K .* F % the 4x1 is implicitly expanded to 4x4 for this element-wise operation
K * F % a normal matrix multiply
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Volume Visualization についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!