|
|
@@ -60,9 +60,9 @@ M = 1; % Differential delay (only 1)
|
|
|
% ---- FIR filter parameters
|
|
|
% ------------------------------------------------------------------------
|
|
|
|
|
|
-NFIR = 15; % Filter order, must be odd when Fo = 0.5 !!!
|
|
|
+NFIR = 16; % Filter order, must be odd when Fo = 0.5 !!!
|
|
|
Bc = 16; % Coef. Bit-width
|
|
|
-Fo = 0.5; % Normalized Cutoff: 0.2 < Fo < 0.5;
|
|
|
+Fo = 0.4; % Normalized Cutoff: 0.2 < Fo < 0.5;
|
|
|
BETA = 8; % BETA parameter for Kaiser window (if IS_WIND = 'Y')
|
|
|
|
|
|
%% ------------------------------------------------------------------------
|
|
|
@@ -73,8 +73,8 @@ IS_COE = 'Y'; % create *.COE Xilinx file
|
|
|
IS_HDR = 'N'; % create *.H file (header)
|
|
|
IS_WIND = 'N'; % use Kaiser Window for FIR corrector
|
|
|
|
|
|
-IS_PLOT_IDL = 'Y'; % plot ideal response
|
|
|
-IS_PLOT_FIR = 'Y'; % plot FIR filter IR
|
|
|
+IS_PLOT_IDL = 'N'; % plot ideal response
|
|
|
+IS_PLOT_FIR = 'N'; % plot FIR filter IR
|
|
|
IS_PLOT_ERR = 'N'; % plot total error response in passband
|
|
|
|
|
|
%% ------------------------------------------------------------------------
|
|
|
@@ -173,28 +173,7 @@ end
|
|
|
% ------------------------------------------------------------------------
|
|
|
|
|
|
## ---- Figure #1
|
|
|
-figure('name','CIC/FIR Frequency Response', 'Numbertitle', 'off')
|
|
|
- plot(ff, HCICdb - max(HCICdb), '-.', 'LineWidth', 2, 'Color',[0 0 1]);
|
|
|
- hold on;
|
|
|
-
|
|
|
- plot(ff, H_amp, '--', 'LineWidth', 2, 'Color',[0 0.4 0]);
|
|
|
- hold on;
|
|
|
-
|
|
|
- plot(ff, H_comp, '-', 'LineWidth', 2, 'Color',[1 0 0]);
|
|
|
- hold on;
|
|
|
-
|
|
|
- title([{'CIC, Comp. FIR and Result'};{sprintf('Filter Order = %i, Coef. width = %i',NFIR,Bc)}]);
|
|
|
- xlabel ('Freq (\pi x rad / samples)');
|
|
|
- ylabel ('Magnitude (dB)');
|
|
|
- axis([0 ff(NFFT)/2 -100 5]);
|
|
|
- line([Fr Fr], [-400 200], 'LineWidth', 1, 'linestyle', '--', 'Color', [0 0 1]);
|
|
|
- line([Fc Fc], [-400 200], 'LineWidth', 1, 'linestyle', '-.', 'Color', [0 0.4 0]);
|
|
|
- line([2*Fc 2*Fc], [-400 200], 'LineWidth', 1, 'linestyle', '--', 'Color', [1 0 0]);
|
|
|
- legend('CIC filter','Comp. FIR','Sum Response','location','northeast');
|
|
|
- grid on;
|
|
|
-
|
|
|
-## ---- Figure #2
|
|
|
-##figure('name', 'CIC/FIR Frequency Response (Zoom)', 'Numbertitle', 'off')
|
|
|
+##figure('name','CIC/FIR Frequency Response', 'Numbertitle', 'off')
|
|
|
## plot(ff, HCICdb - max(HCICdb), '-.', 'LineWidth', 2, 'Color',[0 0 1]);
|
|
|
## hold on;
|
|
|
##
|
|
|
@@ -207,10 +186,30 @@ figure('name','CIC/FIR Frequency Response', 'Numbertitle', 'off')
|
|
|
## title([{'CIC, Comp. FIR and Result'};{sprintf('Filter Order = %i, Coef. width = %i',NFIR,Bc)}]);
|
|
|
## xlabel ('Freq (\pi x rad / samples)');
|
|
|
## ylabel ('Magnitude (dB)');
|
|
|
-## axis([0 ff(NFFT)/(2*R) -7 1]);
|
|
|
-## line([Fr Fr], [-400 200], 'LineWidth', 1, 'linestyle', '--', 'Color', [0 0 0]);
|
|
|
+## axis([0 ff(NFFT)/2 -100 5]);
|
|
|
+## line([Fr Fr], [-400 200], 'LineWidth', 1, 'linestyle', '--', 'Color', [0 0 1]);
|
|
|
+## line([Fc Fc], [-400 200], 'LineWidth', 1, 'linestyle', '-.', 'Color', [0 0.4 0]);
|
|
|
+## line([2*Fc 2*Fc], [-400 200], 'LineWidth', 1, 'linestyle', '--', 'Color', [1 0 0]);
|
|
|
+## legend('CIC filter','Comp. FIR','Sum Response','location','northeast');
|
|
|
## grid on;
|
|
|
|
|
|
+## ---- Figure #2
|
|
|
+figure('name', 'CIC/FIR Frequency Response (Zoom)', 'Numbertitle', 'off')
|
|
|
+ plot(ff, HCICdb - max(HCICdb), '-.', 'LineWidth', 2, 'Color',[0 0 1]);
|
|
|
+ hold on;
|
|
|
+
|
|
|
+ plot(ff, H_amp, '--', 'LineWidth', 2, 'Color',[0 0.4 0]);
|
|
|
+ hold on;
|
|
|
+
|
|
|
+ plot(ff, H_comp, '-', 'LineWidth', 2, 'Color',[1 0 0]);
|
|
|
+ hold on;
|
|
|
+
|
|
|
+ title([{'CIC, Comp. FIR and Result'};{sprintf('Filter Order = %i, Coef. width = %i',NFIR,Bc)}]);
|
|
|
+ xlabel ('Freq (\pi x rad / samples)');
|
|
|
+ ylabel ('Magnitude (dB)');
|
|
|
+ axis([0 1 -300 0]);
|
|
|
+ grid on;
|
|
|
+
|
|
|
%% ------------------------------------------------------------------------
|
|
|
% ---- Passband irregularity
|
|
|
% ------------------------------------------------------------------------
|