diff --git a/applications/lofar2/model/pfb_bunton_annotated/polyphase_synthesis_b.m b/applications/lofar2/model/pfb_bunton_annotated/polyphase_synthesis_b.m index c13e920b95c837b9ba14ebc9d32ea9ed39c81284..8a311835f6a6d31688a17a955fbc8f29c44b7fee 100644 --- a/applications/lofar2/model/pfb_bunton_annotated/polyphase_synthesis_b.m +++ b/applications/lofar2/model/pfb_bunton_annotated/polyphase_synthesis_b.m @@ -20,24 +20,22 @@ Ncoefs = Ntaps * Nfft; bfir = (1:Ncoefs) * 0; bfir(1:length(filt)) = filt; -% IFFT -for n = 1:nof_blocks - temp(n, 1:Nfft) = real(ifft(inBins(n,:))); -end - outData = (1:nof_blocks*Nstep + Ncoefs) * 0; for n = 1:nof_blocks + % IFFT + inData = real(ifft(inBins(n,:))); + % Copy the FFT data at each FIR tap - temp2 = (1:Ncoefs) * 0; + tapData = (1:Ncoefs) * 0; for m = 0:Ntaps-1 - temp2((1:Nfft) + m*Nfft) = temp(n, 1:Nfft); + tapData((1:Nfft) + m*Nfft) = inData; end % Apply the FIR coefficients by using bfir as window - temp2 = temp2 .* bfir; + tapData = tapData .* bfir; % Sum the FIR taps by overlap add the weighted input to the output. % Progress with Nstep per block of Nfft to upsample by Nstep, to match % the downsample by Nstep of the analysis filterbank. range = (1:Ncoefs) + (n-1)*Nstep; - outData(range) = outData(range) + temp2; % continuous time output + outData(range) = outData(range) + tapData; % continuous time output end