Input of array into equation won't return array?

8 次查看(过去 30 天)
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?

采纳的回答

Ankitha Kollegal Arjun
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);

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 String 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by