I've got a series of numbers ranging from 2 to 50. How can I make matlab make a calculation for each value and put the results as another column right next to it?

[1,2,3,4,5,6] Let's say that this is my column and I want matlab to make the calculation "(10/n)" in which n represents each value on the column. How can I make matlab do the same calculation for each value and put the all results as a newly added column?

 Accepted Answer

E.g.,
x = [1;2;3;4;5;6]; % <-- Use ; separator to make column vector
y = [x,10./x]; % <-- Use element-wise division operator ./

More Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Tags

Asked:

on 21 Oct 2015

Commented:

on 21 Oct 2015

Community Treasure Hunt

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

Start Hunting!