Avoid autoscaling of wordlength and fractionlength in fixed point objects

2 ビュー (過去 30 日間)
Italo
Italo 2012 年 11 月 30 日
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 件のコメント
Walter Roberson
Walter Roberson 2012 年 11 月 30 日
Does it happen for other arithmetic operations, or just for sqrt() ?

サインインしてコメントする。

回答 (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 Center および File ExchangeMultirate Signal Processing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by