single precision simulation of internal calculations

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

I know you are not using toolboxes, but just want to point out that beamformers in Phased Array System Toolbox does support single precision where all internal computatino is also done in single precision. Maybe you can use this as a baseline to compare with your own implementation.
HTH
When I looked at the documentation for the Phased Array Toolbox, it said that it only supported double precision data types.
Which functions, System objects, and/or blocks did you see their documentation say they supported only double precision, and which release are you using? I see in the Phased Array System Toolbox Release Notes that in releases R2018b and R2019a more functions, System objects, and blocks support single precision.
Thanks for pointing out that documentation page. I think it is in need of updating to reflect the increase in capability of Phased Array System Toolbox in recent releases. I've brought it to the attention of the documentation staff.
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.
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

Sign in to comment.

 Accepted Answer

James Tursa
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.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!