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 Center および File ExchangeFixed-Point Designer についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by