고정소수점 변환
부동소수점 코드를 고정소수점으로 변환, 고정소수점 데이터형 최적화(Fixed-Point Designer™ 필요)
Fixed-Point Designer 제품이 있는 경우 타깃 하드웨어 제약 조건을 충족하도록 고정소수점 C/C++ 코드를 생성합니다.
클래스
coder.FixPtConfig | Floating-point to fixed-point conversion configuration object |
함수
coder | MATLAB Coder 앱을 엽니다. |
codegen | MATLAB 코드에서 C/C++ 코드 생성 |
coder.config | 코드 생성 구성 객체 만들기 |
coder.approximation | Create function replacement configuration object |
coder.float2fixed.skip | Exclude functions from fixed-point conversion (R2024b 이후) |
도움말 항목
자동화된 고정소수점 변환 워크플로
- 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 Language Features Supported for Automated Fixed-Point Conversion
For automated fixed-point conversion, use supported MATLAB® language features. - Fixed-Point Code for MATLAB Classes
Use supported constructs and coding style best practices for fixed-point conversion of MATLAB classes. - Convert MATLAB Code to Fixed-Point C Code
Generate fixed-point C code withcodegen
. - Convert Fixed-Point Conversion Project to MATLAB Scripts
Use project settings for fixed-point conversion at the command line.
고정소수점 데이터형 제안
- Specify Type Proposal Options
Specify options used when proposing types for automated fixed-point conversion. - Propose Fixed-Point Data Types Based on Simulation Ranges
Propose fixed-point data types based on simulation ranges using thecodegen
function. - Propose Fixed-Point Data Types Based on Derived Ranges
Propose fixed-point data types based on static ranges using thecodegen
function.
함수 대체
- Replacing Functions Using Lookup Table Approximations
Generate lookup table approximations to replace custom functions or functions that are not supported for fixed point. - Replace the exp Function with a Lookup Table
Replace a function with a lookup table approximation in fixed-point code generated with thecodegen
function. - Replace a Custom Function with a Lookup Table
Replace a custom function with a lookup table approximation function by using thecodegen
function.
고정소수점 변환 검증
- 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. - Enable Plotting Using the Simulation Data Inspector
Inspect and compare floating-point and fixed-point logged input and output data. - Custom Plot Functions
Visualize numerical differences during fixed-point conversion. - Detect Overflows
Detect overflows at the command line.
문제 해결하기
- Generated Fixed-Point Code
Avoid issues with generated fixed-point code. - Data Type Issues in Generated Code
Highlight potential data type issues in report.