MATLAB: Question about how to formulate this vector

vector

Hey guys,
I am having a trouble now.
I would like to create a vector, a2 = 1.0000 0.5000 0.3333 0.2500 0.2000, but I can only have "exactly one line of code".
For example, the code xx = 1 : 6 is acceptable; the code xx = [1, 2, 3, 4, 5, 6] is not.
In addition, loop is not the right choice.
Could someone help me about it?Thanks a lot!

Best Answer

I would generate ‘a2’ simply as:
a2 = 1./[1:6]
a2 =
1 0.5 0.33333 0.25 0.2 0.16667
One line of code, as required.
Related Question