フィルターのクリア

matrix multiplication error with too many variables in the equation .

1 回表示 (過去 30 日間)
sanjay lakshminarayana
sanjay lakshminarayana 2019 年 8 月 25 日
コメント済み: Walter Roberson 2019 年 8 月 26 日
ds = C*rho^(1/6)*m_v.*0.352*Vm2^0.857;
In the above equation , m_v = 1e-3:1:1000;
however I d like to run the same equation with rho = 3.4:1:100; C = 0.2:0.1:0.9; and so on . However I am unable to do so and i get an error which says matrix dimensions dont match or first matrix dimension and second matrix dimensions dont match.
I have tried .* and .^ but the error persists. Please help me out . Thank you in advance.
  1 件のコメント
Walter Roberson
Walter Roberson 2019 年 8 月 26 日
If you want all the combinations, have a look at ndgrid()

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

採用された回答

Bjorn Gustavsson
Bjorn Gustavsson 2019 年 8 月 26 日
Your first multiply are a matrix multiplication, you can achieve what you want if you
make sure that C is a column-vector and the second factor is a row-vector (rho.^(1/6)):
C = [1;2;3];
rho = [1 3 5 7 13];
ds = C*rho.^(1/6);
If your Vm2 is a matrix with some additional sizes you might have to loop a bit more.
Then you simply might be best off by looping over the values of m_v. If C and rho doesn't change calculate that product outside of the loop.
HTH

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeArray Geometries and Analysis についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by