The following fixedpoint Simulink^{®} blocks provide a mode for scaling parameters whose values are constant vectors or matrices:
This scaling mode is based on binarypointonly scaling. Using this mode, you can scale a constant vector or matrix such that a common binary point is found based on the best precision for the largest value in the vector or matrix.
Constant scaling for best precision is available only for fixedpoint data types with unspecified scaling. All other fixedpoint data types use their specified scaling. You can use the Data Type Assistant (see Specify Data Types Using Data Type Assistant (Simulink)) on a block dialog box to enable the best precision scaling mode.
On a block dialog box, click the Show data type assistant button .
The Data Type Assistant appears.
In the Data Type Assistant, and
from the Mode list, select Fixed
point
.
The Data Type Assistant displays additional options associated with fixedpoint data types.
From the Scaling list, select Best
precision
.
To understand how you might use this scaling mode, consider a 3by3 matrix of doubles, M, defined as
3.3333e003 3.3333e004 3.3333e005 3.3333e002 3.3333e003 3.3333e004 3.3333e001 3.3333e002 3.3333e003
Now suppose you specify M as the value of the Gain parameter for a Gain block. The results of specifying your own scaling versus using the constant scaling mode are described here:
Specified Scaling
Suppose the matrix elements are converted to a signed, 10bit
generalized fixedpoint data type with binarypointonly scaling of 2
^{7} (that
is, the binary point is located seven places to the left of the right
most bit). With this data format, M becomes
0 0 0 3.1250e002 0 0 3.3594e001 3.1250e002 0
Note that many of the matrix elements are zero, and for the nonzero entries, the scaled values differ from the original values. This is because a double is converted to a binary word of fixed size and limited precision for each element. The larger and more precise the conversion data type, the more closely the scaled values match the original values.
Constant Scaling for Best Precision
If M is scaled based on its largest matrix value, you obtain
2.9297e003 0 0 3.3203e002 2.9297e003 0 3.3301e001 3.3203e002 2.9297e003
Best precision would automatically select the fraction length that minimizes the quantization error. Even though precision was maximized for the given word length, quantization errors can still occur. In this example, a few elements still quantize to zero.
Simulink data type names must be valid MATLAB^{®} identifiers with less than 128 characters. The data type name provides information about container type, number encoding, and scaling.
You can represent a fixedpoint number using the fixedpoint scaling equation
$$V\approx \stackrel{~}{V}=SQ+B,$$
where
V is the realworld value.
$$\stackrel{~}{V}$$ is the approximate realworld value.
$$S=F{2}^{E}$$ is the slope.
F is the slope adjustment factor.
E is the fixed poweroftwo exponent.
Q is the stored integer.
B is the bias.
For more information, see Scaling.
The following table provides a key for various symbols that appear in Simulink products to indicate the data type and scaling of a fixedpoint value.
Symbol  Description  Example 

Container Type  
 Unsigned fixedpoint data type 

 Signed fixedpoint data type 

 Scaled
Doubles override of an unsigned fixedpoint data type ( 

 Scaled
Doubles override of a signed fixedpoint data type ( 

Number Encoding  
 10^ 

 Negative 

 Decimal point 

Scaling Encoding  
 Slope 

 Bias 

 Fixed exponent (2^) A negative fixed exponent describes the fraction length 

 Slope adjustment factor 

C,c,D, or d  Compressed encoding for Bias NoteIf you pass this symbol to the  No example available. For backwards compatibility only. To
identify and replace calls to 
T or t  Compressed encoding for Slope NoteIf you pass this symbol to the  No example available. For backwards compatibility only. To
identify and replace calls to 