1)

For embedded designs, if at all possible consider changing your design to work with revolutions instead of radians.

1 revolution = 360 degrees = 2*pi radians

Many angle sensors are perfectly matched for recording angles in revolutions. For example, a spec. sheet may say that each angle sensor pulse equals 360 degrees / 4096. This is equivalent to 2^-12 revolutions per pulse. Equivalently, 4096 pulses equals one revolution. For this sensor, great data types for the angle would be

numerictype(0,12,12) % 0 to just under 1 revolution

numerictype(0,16,12) % 0 to just under 16 revolutions

Updating this angle would be lossless and would require a simple increment or add. In contrast, trying to record the angle in degrees or radians would always involve precision loss for representing 360/4096 or 2*pi/4096, and would require more math and bigger types.

To compute things like sine or cosine, it is generally useful to do a modulo first. A huge advantage to angles in revolutions with binary scaled fixed point is that modulo 1 revolution is lossless and trival. Just a simple masking operation to keep all the fraction bits and drop any integer bits. In contrast, attempting to do module 360 or 2*pi requires more costly calculations and can introduce precision losses.

2)

To create your evenspaced vector of n elements, covering the closed open interval [0, valueMax).

2a)

You gave an example of n = 1000.

If possible consider changing to an exact power of two like n = 1024 = 2^10. It will generally make the math nicer, and if using revolutions, then the math will be lossless too.

2b)

You need to pick one fixed-point data type for the entire vector. You cannot use different data types for each element of the vector. First determine, the level of accuracy required. For example, if the angle will be coming from the sensor example above with 4096 ticks per revolution, then a Fraction Length of 12 is a perfect choice. Based on the desired FractionLength, the rest of the data type attributes can be determined

2c)

The attached script

evenAngleVecCalc.m

shows how to set the output data type and compute the vector.

-Andy