MATLAB 中的自动定点转换
使用 fiaccel 转换为定点
在命令行中使用 fiaccel 将浮点 MATLAB® 代码转换为定点 MATLAB 代码。
函数
fiaccel | Accelerate fixed-point code or convert floating-point MATLAB code to fixed-point MATLAB code |
coder.config | 为定点或单精度转换创建配置对象 |
coder.approximation | Create function replacement configuration object |
coder.allowpcode | 从 P 代码文件控制代码生成 |
coder.const | 在生成的代码中将表达式折叠为常量 |
coder.extrinsic | 将函数声明为外部函数,并在 MATLAB 中执行它 |
coder.float2fixed.skip | Exclude functions from fixed-point conversion (自 R2024b 起) |
coder.inline | 控制生成代码中当前函数的内联 |
coder.inlineCall | 在生成的代码中内联被调函数 (自 R2024a 起) |
coder.load | 在代码生成时从 MAT 文件或 ASCII 文件加载常量 |
coder.newtype | Create coder.Type object to represent type of an entry-point
function input |
coder.nonInlineCall | 防止在生成的代码中内联被调函数 (自 R2024a 起) |
coder.nullcopy | 在生成的代码中声明未初始化的变量 |
coder.resize | 调整 coder.Type 对象的大小 |
coder.target | 确定代码生成目标是否为指定的目标 |
coder.typeof | 创建 coder.Type 对象来表示入口函数输入的类型 |
coder.unroll | 通过为每次循环迭代生成循环体的副本来展开 for 循环 |
coder.varsize | 解决大小不兼容性错误并声明上界 |
类
coder.mexconfig | Code acceleration configuration object for use with
fiaccel |
coder.FixPtConfig | Floating-point to fixed-point conversion configuration object |
coder.ArrayType | 表示输入设定可接受的一组 MATLAB 数组 |
coder.Constant | Specification of constant value for code generation |
coder.EnumType | Represent set of MATLAB enumerations acceptable for input specification |
coder.FiType | Represent set of MATLAB fixed-point arrays acceptable for input specification |
coder.PrimitiveType | Represent set of logical, numeric, or character arrays acceptable for input specification |
coder.StructType | 表示输入设定可接受的一组 MATLAB 结构体数组 |
coder.Type | 表示输入设定可接受的一组 MATLAB 值 |
主题
自动定点转换工作流
- 决定哪种工作流适合您的应用
了解每种转换工作流的好处,以帮助您确定最适合您需求的工作流。 - Fixed-Point Conversion Workflows
Learn which fixed-point conversion method best matches your end goal and your level of fixed-point expertise. - Automated Fixed-Point Conversion
Using the command line to perform automated fixed-point conversion. - Automated Fixed-Point Conversion Best Practices
Generate fixed-point code according to best practices. - 将定点转换工程转换为 MATLAB 脚本
在命令行中使用工程设置进行定点转换。
转换为定点
- Specify Type Proposal Options
Specify options when proposing types for automated fixed-point conversion. - Generated Fixed-Point Code
Avoid issues with generated fixed-point code. - Replacing Functions Using Lookup Table Approximations
Generate lookup table approximations to replace custom functions or functions that are not supported for fixed point. - Custom Plot Functions
Visualize numerical differences during fixed-point conversion.
支持的语言功能
- MATLAB Language Features Supported for Automated Fixed-Point Conversion
Learn which language features are and are not supported for automated fixed-point conversion. - Fixed-Point Code for MATLAB Classes
Use supported constructs and coding style best practices for fixed-point conversion of MATLAB classes. - System Objects Supported for Automated Fixed-Point Conversion
Use thefiaccelfunction to automatically propose and apply data types for commonly used system objects.
命令行工作流
- Propose Data Types Based on Simulation Ranges Using the fiaccel Function
Propose fixed-point data types based on simulation ranges using thefiaccelfunction. - Propose Data Types Based on Derived Ranges Using the fiaccel Function
Propose fixed-point data types based on static ranges using thefiaccelfunction. - Detect Overflows
Detect overflows at the command line. - Replace the exp Function with a Lookup Table
Replace a function with a lookup table approximation in fixed-point code generated with thefiaccelfunction. - Replace a Custom Function with a Lookup Table
Replace a custom function with a lookup table approximation function by using thefiaccelfunction. - Enable Plotting Using the Simulation Data Inspector
Inspect and compare floating-point and fixed-point logged input and output data. - Visualize Differences Between Floating-Point and Fixed-Point Results
Use a custom plot function to compare the behavior of the generated fixed-point code against the behavior of the original floating-point MATLAB code.
疑难解答
Avoid issues with generated fixed-point code.
Data Type Issues in Generated Code
Highlight potential data type issues in report.