How do I generate a vector that has 10000 terms?

11 次查看(过去 30 天)
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.

采纳的回答

Star Strider
Star Strider 2014-2-23
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Multidimensional Arrays 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by