Change the output data type

조회 수: 3 (최근 30일)
Ho
Ho 2023년 8월 8일
답변: Sahas 2024년 12월 18일
I have a simulink model as follows
As you can see the data output is in the form fixed fixdt(1,14,12). Can anyone help me convert the output to fixdt(1,14,13)? what block do i have to use to do that? This is my model
  댓글 수: 2
Kiran Kintali
Kiran Kintali 2023년 8월 8일
Please consider using fixed point designer to analyze ranges and use better fixed point types in the blocks.
Kiran Kintali
Kiran Kintali 2023년 8월 9일
Found few incorrect constant types. For example you had a constant block where '1' cannot be represented with the output type set on the block.
>> a = fi(0, 0,14,14)
a =
0
DataTypeMode: Fixed-point: binary point scaling
Signedness: Unsigned
WordLength: 14
FractionLength: 14
>> a.range
ans =
0 0.999938964843750
DataTypeMode: Fixed-point: binary point scaling
Signedness: Unsigned
WordLength: 14
FractionLength: 14
>>
Attached model with the necessary changes.

댓글을 달려면 로그인하십시오.

답변 (1개)

Sahas
Sahas 2024년 12월 18일
Hi @Ho,
MathWork's "fixdt" function creates a "Simulink.NumericType" object describing a fixed-point or floating-point data type. You can utilize this function, in a "Data-type Converter" block and get the desired output data type. Follow the steps below and get the desired output data type:
  • Double click the DTC block to open it's Block Parameters.
  • In the Output Data Type field choose "<data type expression>".
  • Enter the required output data type following the "fixdt" function conventions.
  • Assuming that the Value is in the valid range, you will get the desired output data type as shown in the image below:
For more information on "fixdt" function and "DTC" block, refer to the following MathWorks documentation links:
Hope this is beneficial!

카테고리

Help CenterFile Exchange에서 HDL Code Generation에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by