This model shows how to exercise a custom C language S-function written to compute a fixed-point "product and sum" operation. To see the source code for the S-function, use the right-click
A custom C language S-function written to generate a constant value. This operation is available in Simulink® with the "Constant" block, which can be used for comparison with this
This model shows how to propagate fixed-point data types in fixed-point S-Functions. It exercises a custom C language S-function written to enforce data types across multiple signals.
A custom C language S-function written to perform an arithmetic shift. This operation is available in Simulink® with the "Shift Arithmetic" block, which can be used for comparison with this
Use the FixPt To FixPt Inherited block. Because Simulink® propagates data types throughout a block diagram, fixed-point utility modeling can be templatized for multiple use scenarios.
Optimize fixed-point operations in generated code using minimum and maximum values that you specify in a model.
This model shows how sample implementations of filtered and unfiltered fixed-point derivative algorithms compare with their floating-point implementations.
Perform high precision calculations in the Interpolation Using Prelookup block using internal rules. The Interpolation block allows the data type for intermediate results to be set.
A comparison between various fixed-point integrator realizations and an equivalent floating point realization.
Control generation of multiword operations in generated code.
This model shows how to convert signals between built-in and fixed-point data types and illustrates how fixed-point data types affect the representable precision and range. The
Control the generation of multiplication helper functions in the generated code.
How Prelookup blocks share utility functions. The utility functions generated by the Prelookup block are determined by the target data type of the block's inputs, outputs, and breakpoint
Convert from one fixed-point data type to another fixed-point data type. In this case the conversion is between sfix32_En2 and ufix8_En1, meaning:
Some of the features of Prelookup and Interpolation Using Prelookup blocks.
This model shows sample implementations of fixed-point state space realizations with a comparison to floating-point implementations.
Sample fixed-point implementations of a discrete lead filter and a discrete lag filter along with reference implementations in floating point.
Implement a direct form filter in fixed point using fundamental building blocks such as Gain, Delay, and Sum.
Construct a fixed-point series cascade form filter using the fundamental building blocks of delay, sum, and gain.
Implement a parallel form filter in fixed point using fundamental building blocks such as Gain, Delay, and Sum.
Use the function fixpt_look1_func_plot to find the maximum absolute error for the simple lookup table whose breakpoints are 0, 0.25, and 1. The corresponding Y data points of the lookup
When you want to optimize for both memory and absolute tolerance, it is helpful to visualize the tradeoffs between the two. This example creates a lookup table approximation of the function
Optimize an existing Lookup Table block for memory efficiency. Open the model containing the Lookup Table block that you want to optimize.
Find the approximation to an ideal function of y = sin(2*pi*x) over an input range [xmin,xmax] using a lookup table approach. Fixed-point applications often need to approximate a function
Use derived range analysis to collect ranges that then can be used by the Fixed-Point Tool to propose fixed-point scaling.
Use the Fixed-Point Advisor (FPA) to prepare a floating-point model or subsystem for conversion to fixed point. After preparation, use the Fixed-Point Tool to convert the floating-point