How do I create a regularly-spaced array of values in MATLAB? -
How do I create an array defined with a starting point, an end point, and a total array size? Something like an array that goes from 1 to 10, which is 20 elements long. For example, the array might look like this:
1 1.5 2 2.5 3 3.5 ...
You can do some things that you can do:
-
Use it:
startvalu = 1; EndValue = 10; Enlightenments = 20; StepSize = (end value-start value) / (Eniles-1); A = starting value: step size: end value;
-
Using the function (as suggested):
startValue = 1; EndValue = 10; Enlightenments = 20; A = Lynxpace (startvalue, and value, enelments); In the above examples, the difference between array element values will be
9/19
, orLess than 0.5
(as opposed to sample array) question).
Comments
Post a Comment