Modern PC's use floating point numbers to calculate non-integral values.
These come in two standardized variants: float
and double
, where the latter is twice the size of the former.
Matlab, by default uses (complex) double
s for all its calculations.
You can force it to use float
(or as Matlab calls them, single
) by specifiying the type:
a = single([20, 25.0540913632159, 16.2750000000000, 3.08852992798468]);
This should use half the memory, and you lose some precision that may or may not be important in your application. Make sure the optimization is worth it before doing this, as execution speed may even be slower (due to builtin functions only operating on double
, hence requiring two conversions extra).