How do I generate a vector that has 10000 terms?

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.

 Réponse acceptée

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 commentaire

Matlab12
Matlab12 le 23 Fév 2014
yes I meant values, thank you so much. I can not believe it was that simple.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by