Input of array into equation won't return array?

조회 수: 3 (최근 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?

채택된 답변

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);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by