Forum Discussion
Altera_Forum
Honored Contributor
13 years ago --- Quote Start ---
G = (2^(2*N-1)*(R*M)^(i-N))/R; should be according to Hogenauer G = (2^(2*N-i)*(R*M)^(i-N))/R; --- Quote End --- Thanks FvM. That makes sense now, just a typing error from doc to doc. new code(final??): Bin = 8; %input width N = 4; %stages of comb or integrator M = 2; %differential delay R = 512; %interpolation rate %cic decimator at any stage Bout = N * log2(R*M) + Bin; %cic interpolator per ith stage %stages 1~N for i = 1:N G = 2^i; Bout = Bin + log2(G); d(i) = Bout; end %N+1 ~ 2N stages for i = N+1:N*2 G = 2^(2*N-i)*(R*M)^(i-N)/R; Bout = Bin + log2(G); d(i) = Bout; end for i = 1:N*2 fprintf('%i %i\r',i,d(i)); end