Avoid autoscaling of wordlength and fractionlength in fixed point objects

조회 수: 2 (최근 30일)
Italo
Italo 2012년 11월 30일
답변: MathWorks Fixed Point Team 2025년 7월 24일
Hello, I set a fixed point object with wordlength 16 and fractionlength 4
x=ufi(16,12,4)
but when I make an operation on the object, the wordlength and fractionlength get changed, for example
y = sqrt(x)
scales those to 6 and 2 respectively.
How can I avoid this autoscaling?
Thanks!

답변 (1개)

MathWorks Fixed Point Team
MathWorks Fixed Point Team 2025년 7월 24일
SQRT function computes the square root of a fi object using a bisection algorithm.
You can use additional numerictype to control the output data types:
c = sqrt(a,T) returns the square root of fi object a with numerictype object T. Intermediate quantities are calculated using the fimath associated with a. See Data Type Propagation Rules.
x=ufi(16,12,4)
T = numerictype(0, 12, 4)
y = sqrt(x,T);
The choice of output data type without specifying T is documented as "internal rule" section of the function reference.

카테고리

Help CenterFile Exchange에서 Multirate Signal Processing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by