sum() doesn't adjust fixpoint wordlength

조회 수: 1 (최근 30일)
Lennart
Lennart 2015년 6월 18일
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!

답변 (0개)

카테고리

Help CenterFile Exchange에서 Fixed-Point Designer에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by