function out = MyIIR(a,b,x,YStartState,sel_double) len = length(x); switch sel_double case 0 x = int64(x); a = int64(a); b = int64(b); y(1) = int64(YStartState); case 1 x = double(x); a = double(a); b = double(b); y(1) = double(YStartState); end switch sel_double case 0 for i = 1:len-1 y_tmp(i+1) = a*x(i+1) - b*y(i)'; y(i+1) = bitsra(y_tmp(i+1),20) + bitget(y_tmp(i+1),64); end out = bitsra(y,16); case 1 for i = 1:len-1 y_tmp(i+1) = floor(a*x(i+1) - b*y(i)'); y(i+1) = floor(y_tmp(i+1)/2^20) + bitget(int64(y_tmp(i+1)),64); end out = floor(y/2^16); end