You can use linspace
to create n
equidistant values in the interval [0.8, 1.6]
, where n
is the input number.
Here's an example script:
main.m167 chars9 lines
This script prompts the user to enter the number of equidistant values they want, then creates those values using linspace
, and displays them.
For example, if the user enters 4
, the output would be:
main.m86 chars3 lines
Note that the values are evenly spaced between 0.8 and 1.6.
gistlibby LogSnag