Avoid autoscaling of wordlength and fractionlength in fixed point objects
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentar
Walter Roberson
am 30 Nov. 2012
Does it happen for other arithmetic operations, or just for sqrt() ?
Antworten (1)
MathWorks Fixed Point Team
am 24 Jul. 2025
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.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Multirate Signal Processing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!