MATLAB: Input of array into equation won’t return array

arrayMATLAB and Simulink Student Suite

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?

Best Answer

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