How do I generate a vector that has 10000 terms?

12 views (last 30 days)
I have tried generating a vector variable that is supposed to have the assigned variables 1, 1/2, 1/3, 1/4, 1/5... 1/10,000. It is supposed to be a sequence of 10,000 terms. I have tried using start values and nElements but i keep on getting an error.

Accepted Answer

Star Strider
Star Strider on 23 Feb 2014
I assume you mean ‘assigned values’, not ‘assigned variables’. This is one way to create your vector:
v = 1./(1:10000);
To get any element of it (in this case the 10th element):
V10 = v(10);
If I misunderstood you and you really did mean variables, that is another problem altogether.
  1 Comment
Matlab12
Matlab12 on 23 Feb 2014
yes I meant values, thank you so much. I can not believe it was that simple.

Sign in to comment.

More Answers (0)

Categories

Find more on Multidimensional Arrays in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!