block outputs very small number

조회 수: 1 (최근 30일)
Brasco , D.
Brasco , D. 2018년 5월 2일
답변: Jingfang Qu 2018년 6월 22일
Why am I getting a very small number by summing two zeros? (shown below )
Is there any way to prevent this ?

답변 (1개)

Jingfang Qu
Jingfang Qu 2018년 6월 22일
Hi,
The output signal of the Add block is not usual. The machine epsilon for double precision decimal is 1E-16; however the result here is much less than that. The possible reason here is the signal datatype of the Add block is set to be fixed point.
Please refer to the following link for more information about fixed point:
If you want to get rid of such result, you can set the datatype to be double:
1. Double click on the block, Signal Attributes->Output data type.
2. In the drop down list, choose double.
3. Click Apply , then click OK.
To make sure the datatype is set as expected, you can view the signal datatype by the following:
Display->Signals and Ports->Port Data Types.

카테고리

Help CenterFile Exchange에서 Sources에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by