single precision simulation of internal calculations
2 views (last 30 days)
Show older comments
I would like to experiment with beamforming. The hardware which may host the algorithm is only able to support single precision calculations. Is there a way to set Matlab to perform all calculations (even internal) to single precision? I am writing this iteration of the beamformer to avoid the use of toolboxes and their functions. Since this attempt is a first order estimate, I am limting the calculations to elementary mathemtical functions (exponentials, sines etc.).
7 Comments
Honglei Chen
on 3 Jun 2019
There is nothing for you to specifically set. It depends on the input you pass in. In general, we use the data type of the data input to determine what precision of the interal calculation. For example, if your data input of the PhaseShiftBeamformer is single, then the computation will be carried out in single.
HTH
Accepted Answer
James Tursa
on 28 May 2019
Edited: James Tursa
on 28 May 2019
" Is there a way to set Matlab to perform all calculations (even internal) to single precision? "
Not the way you are probably wanting. E.g., the literal constant 2 will always be interpreted as a double precision value ... there is no setting that I am aware of that will change that. This forces you to explicitly use single(2) in your code to force a single precision value. Also, there may be library code that MATLAB relies on that uses double (or higher) precision in the background (e.g., double precision accumulators used for single precision inputs, etc.). Strict sIngle precision emulation really isn't something MATLAB is set up to do well.
0 Comments
More Answers (0)
See Also
Categories
Find more on Beamforming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!