Avoid autoscaling of wordlength and fractionlength in fixed point objects
2 views (last 30 days)
Show older comments
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 Comment
Answers (1)
MathWorks Fixed Point Team
on 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 Comments
See Also
Categories
Find more on Multirate Signal Processing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!