Why am I getting a 3x3 array when only using 3x1's in the equation?

2 ビュー (過去 30 日間)
Jackson Law
Jackson Law 2020 年 10 月 19 日
編集済み: Stephen23 2020 年 10 月 20 日
The data I'm using is;
H = [2.8;6.4;11.5]
v = [0.155;0.233;0.310]
k = (H.* (2*9.81)) / (v.^2)
and the output is in the format of [0,0,k]
Why is this happening and is there a way to correct it because I need to plot k and its making it hard
  1 件のコメント
Stephen23
Stephen23 2020 年 10 月 20 日
編集済み: Stephen23 2020 年 10 月 20 日
"Why is this happening..."
Because you are using mrdivide / , which (as its documentation clearly states) solves systems of linear equations:
"...and is there a way to correct it..."
Use the correct operator, you want to use element-wise division rdivide ./
Tip: if you are not doing linear algebra then most likely you need to use array operations, not matrix operations:

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

回答 (1 件)

madhan ravi
madhan ravi 2020 年 10 月 19 日

カテゴリ

Help Center および File ExchangeMultidimensional Arrays についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by