Behavioral Requirements are Key
The key question is whether the system meets its behavioral requirements.
I applied Data Type Override to your model
set_param(bdroot,'DataTypeOverride','Double')
to see the "luxury" simulation behavior using double precision floating point.
I then turned off Data Type Override
set_param(bdroot,'DataTypeOverride','UseLocalSettings')
to see the current fixed-point behavior.
Just from glancing at your Scope blocks, the responses looked pretty similar. But that's superficial.
I suggest you create tests to exercise your model and prove that it meets behavior constraints in doubles.
Write scripts that test the simulation response to show that behavior requirements are met.
The scripts could be informal or use the MATLAB unit testing tools. Key thing is that running the script should clearly indicate if the model meets the behavior requirements.
Then turn on the fixed-point data types and re-run your scripts on the model. Does it still pass the behavioral requirements? If yes, you're done. If not, you could explore where the model is most numerically sensitive and explore using bigger fixed-point data types there.
Precision Loss is Expected
Parameter precison loss messages like the following are to be expected.
"The original value of the parameter, 0.7071067811865475, cannot be represented exactly using the run-time data type sfix16_En15. The value is quantized to 0.70709228515625. Quantization error occurred with an absolute difference of 1.4496030297461715e-5 and a relative difference of 0.00205004826472416%."
It looks like the "ideal" value being used is sqrt(2)/2.
Representing that value even double precision floating-point will involve precision loss.
valIdeal = sqrt( sym(2) ) / 2
valIdeal =
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1653456/image.png)
valDouble = double(valIdeal)
valDouble =
0.707106781186548
errDouble = double( sym(valDouble,'f') - valIdeal )
errDouble =
4.83364665672646e-17
Here are several fixed-point example using best precision scaling with various word lengths.
valFi64 = fi([],0,64,'Value',char(vpa(valIdeal,50)));
wlv = [inf, 64, 53, 32, 24, 16, 8:-1:1];
fprintf("valIdeal = %s...\n",char(vpa(valIdeal,80)))
fiCurrent = fi(valFi64,0,wl);
s2 = " Same accuracy as double";
s2 = " Same accuracy as single";
fprintf("valFi%02d = %-51s %s\n",wl,fiCurrent.Value,s2)
end
valIdeal = 0.70710678118654752440084436210484903928483593768847403658833986899536623923105352...
valFi64 = 0.70710678118654752438189403651591646848828531801700592041015625
valFi53 = 0.70710678118654757273731092936941422522068023681640625 Same accuracy as double
valFi32 = 0.707106781192123889923095703125
valFi24 = 0.707106769084930419921875 Same accuracy as single
valFi16 = 0.7071075439453125
valFi08 = 0.70703125
valFi07 = 0.7109375
valFi06 = 0.703125
valFi05 = 0.71875
valFi04 = 0.6875
valFi03 = 0.75
valFi02 = 0.75
valFi01 = 0.5
The accuracy at 16 bits is pretty good. It's unlikely something you need to worry about. You could set the parameter precision loss diagnostic to None, or you could review each warning, and if OK, then click the suppress link in the Diagnostic Viewer.