Input of array into equation won't return array?

5 ビュー (過去 30 日間)
Ian Gargan
Ian Gargan 2017 年 4 月 12 日
コメント済み: Ian Gargan 2017 年 4 月 18 日
If I input x=1:1:10, then I input y=(3*x)/(3+x). Why do I get y=2.0497 returned instead of an array?
  1 件のコメント
Stephen23
Stephen23 2017 年 4 月 17 日
@Ian Gargan: you are using the wrong operator mrdivide /, when you should be using rdivide ./. Read about the differences here:

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

採用された回答

Ankitha Kollegal Arjun
Ankitha Kollegal Arjun 2017 年 4 月 17 日
Since 'x' is a vector, the '.' operator should be applied for performing division. The '.' operator will perform the operation on each element of the vector. The code will look like:
x = 1:1:10;
y = (3*x)./(3+x);
  1 件のコメント
Ian Gargan
Ian Gargan 2017 年 4 月 18 日
Thank you so much!

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

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by