Forum Discussion
Altera_Forum
Honored Contributor
14 years ago --- Quote Start --- That is great! Before getting too involved in the Quartus solution, go back to MATLAB and look at their CIC and compensating FIR designs. I think they have a downconverter example that shows how to use it, or perhaps it was the book by Losada (available on the MATLAB site). Gain an understanding of how the CIC filter works first, and then what the compensating FIR filter is being used for. Only once you understand that, should you begin the implementation in Quartus. Cheers, Dave --- Quote End --- Hi Dave, I read through the CIC documentation and designed a CIC filter (R=4, M=1, N=9) in MATLAB as well as in QuartusII. In QuatursII, the megafunction of CIC filter generated a matlab file which output the compensating FIR filter coefficients in a .txt file and plot the response of CIC, compensating FIR and the total response. Now, I try to simulate the cascade filter (CIC followed by a FIR filter) object in matlab. The FIR filter is designed by using the output coefficients. but the frequency response of the cascaded filter block is nothing like what I expected. It's also different from the total response plotted by the matlab file. Rather, the FIR filter works nicely as a LPF filter... It really confuses me. Allison %%%%%MATLAB simulation%%%%%% Fs = 50e3; %%%sampling frequency is 50khz %%%CIC filter r = 4; %%%decimation m = 1; n = 9; %%%stage iwl=B_out; %%%input bit width owl=B_out; hm_cic=mfilt.cicdecim(r,m,n,iwl,owl); %%%multi-rate filter design fvtool(hm_cic); %%% filter visual tool %%%%FIR filter L=64; Fc=100; %%%cutoff frequency is 100hz myFIR_fir_comp_coeff(L, fs, Fc, true, true, 16); %%% matlab file generated by Quartus, which will output the compensating coeffcients into a .txt file and plot responses load myFIR_fir_comp_coeff.txt hm_fir = mfilt.firdecim(1,myFIR_fir_comp_coeff); %%%direct-form fir filter fvtool(hm_fir); %%%%cascading the two filters together hm = mfilt.cascade(hm_cic,hm_fir); fvtool(hm);