single precision simulation of internal calculations

2 次查看(过去 30 天)
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 个评论
Marc Adams
Marc Adams 2019-5-31
Could you point me to something in the documentation that will allow me to set the precision of the internal calculations for the phased array toolbox. I haven't found it yet.
Honglei Chen
Honglei Chen 2019-6-3
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

请先登录,再进行评论。

采纳的回答

James Tursa
James Tursa 2019-5-28
编辑:James Tursa 2019-5-28
" 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 个)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by