sum() doesn't adjust fixpoint wordlength
Show older comments
Hi there,
I am currently facing the problem that the sum() function doesn't adjust the word length of my fixpoint variable although the summode is set to FullPrecision
Here is the code of trouble:
shiftValue = max(shifts(i,:));
while max(shiftValue) ~= min(shifts(i,:))-1
sameShifts = find(shifts(i,:) ==shiftValue) %coordinates of max shifts
--> sigOut_fix(i) = (sigOut_fix(i) + sum(sigInLut(i,sameShifts)))*2^(-1);
shiftValue = shiftValue - 1 %reduce the targeted shifting Value
end
The arrow point at the line that doesn't work properly. sameShifts is a vector with coordinates.
I tried it in the command window on the following example, which worked perfectly fine:
x = fi(1: 100, true, 16, 0);
b = fi(3,true,16,0);
a = 5 : 50;
y = fi(0,true,16,0);
y = (b+sum(x(a)))*2^(-1)
After the last row y's word length is grown to 44 as it should be. But why doesn't it work in my while loop? Is this just a bug or am I missing something?
Any help is highly appreciated!
Thanks in advance!
Answers (0)
Categories
Find more on Develop Apps Using App Designer in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!