主要内容

Simulink 中的迭代定点转换

使用引导式工作流将浮点模型转换为定点模型

定点工具在 Simulink® 模型中自动执行数据类型转换任务。该工具根据仿真、推导或设计范围收集模型对象的范围数据。在迭代定点转换工作流中,该工具会基于这些范围数据建议能够最大化精度和覆盖范围的定点数据类型。然后,您可以检查数据类型建议,并有选择地将它们应用于模型中的对象。如果不满足设计要求,您可以调整数据类型建议设置,可视化其效果,并进行迭代,直到系统满足您的要求。

要将模型中的数据类型转换为定点,请按照使用定点工具的迭代定点转换中的步骤操作。有关完整转换过程的示例,请参阅将浮点模型转换为定点模型

DataTypeWorkflow.Converter 对象及其关联的对象函数是定点工具中迭代定点转换的命令行替代项。

工具

定点工具Convert a floating-point model to a fixed-point model

函数

fxptdlgOpen the Fixed-Point Tool
getUnsupportedFunctionsForSystemList unsupported functions used by MATLAB Function blocks in the system under design (自 R2025a 起)

DataTypeWorkflow.ConverterCreate fixed-point converter object
DataTypeWorkflow.findDecoupledSubsystemsGet a list of subsystems to replace with an approximation
DataTypeWorkflow.ProposalSettingsProposal settings object for data type proposals
DataTypeWorkflow.FunctionReplacementObject to store function replacements (自 R2025a 起)
DataTypeWorkflow.ResultObject containing run result information
DataTypeWorkflow.VerificationResultVerification results after converting a system to fixed point

主题

迭代定点转换工作流概述

准备转换系统

收集范围

建议数据类型

转换数据类型

验证结果

疑难解答

Blocks That Do Not Support Fixed-Point Data Types

Troubleshoot blocks that are not supported for fixed-point conversion.

Best Practices for Working with the MATLAB Function Block in Automated Fixed-Point Conversion Workflows

Follow best practices and avoid unsupported MATLAB Function block features.

Best Practices for Working with Stateflow Charts in Automated Fixed-Point Conversion Workflows

Follow best practices for Stateflow® charts to avoid unexpected results.

Models That Might Cause Data Type Propagation Errors

Know which modeling practices could cause data type propagation errors after autoscaling.

Resolve Range Analysis Issues

Troubleshoot range analysis issues.

Fix Design Range Conflicts

Avoid specifying conflicting design minimum and maximum values in your model.

Insufficient Design Range Information

Troubleshoot errors caused by insufficient design range information by providing additional input design minimum and maximum values.

Provide More Design Range Information

Troubleshoot insufficient design range information that prevents successful derived range analysis.

Troubleshoot Range Analysis of System Objects

Reconfigure a System object™, if necessary, so that ranges can be derived for the model.

The Fixed-Point Tool Did Not Propose Data Types

Troubleshoot when the Fixed-Point Tool does not propose data types.

数据类型不匹配和结构体初始条件

示例说明如何用 Simulink.Parameter 对象替换结构体初始条件。

Data Type Propagation Errors After Applying Proposed Data Types

Troubleshoot when the Fixed-Point Tool proposes data types that are not compatible with the model.

精选示例