?? resolvethelastbit.m
字號:
function [bits_alloc, energy_alloc] = ResolvetheLastBit(bits_alloc,energy_alloc,index,energytable,num_subc)max_val = 0;for i = 1:num_subc if (i ~= index & bits_alloc(i) == 1) if bits_alloc(i) ~= 0 temp = energytable(i,bits_alloc(i)) ; end if (temp > max_val) max_val = temp; max_ind = i; end endendmin_val = Inf;for i = 1:num_subc if (i~= index & bits_alloc(i) == 1) if bits_alloc(i) ~=0 temp = energytable(i,bits_alloc(i) + 1); end if (temp < min_val) min_val = temp; min_ind = i; end endendif (min_val < max_val) bits_alloc(min_ind) = bits_alloc(min_ind) + 1; bits_alloc(index) = bits_alloc(index) - 1; energy_alloc(index) = energy_alloc(index) - min_val;else bits_alloc(max_ind) = bits_alloc(max_ind) - 1; bits_alloc(index) = bits_alloc(index) + 1; energy_alloc(index) = energy_alloc(index) + max_val;end
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -