Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
HDL
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RTSD
HDL
Commits
db2bd88a
Commit
db2bd88a
authored
Sep 28, 2016
by
Eric Kooistra
Browse files
Options
Downloads
Patches
Plain Diff
Normalize the coefficients to fit in range +-1, so h_fir_max = 1.
parent
89541917
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
applications/apertif/matlab/pfir_coeff.m
+17
-4
17 additions, 4 deletions
applications/apertif/matlab/pfir_coeff.m
with
17 additions
and
4 deletions
applications/apertif/matlab/pfir_coeff.m
+
17
−
4
View file @
db2bd88a
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
% bandwidth BWchan. Typically BWchan = 1/N or somewhat more have -3dB
% bandwidth BWchan. Typically BWchan = 1/N or somewhat more have -3dB
% reponse between channels.
% reponse between channels.
%
%
% The FIR coe
e
ficients can be caluculated with Matlab 'fir1' or with
% The FIR coe
f
ficients can be caluculated with Matlab 'fir1' or with
% Matlab 'fircls1' dependend on config.design.
% Matlab 'fircls1' dependend on config.design.
%
%
% For Matlab fircls1() r_pass and r_stop are the maximum passband and
% For Matlab fircls1() r_pass and r_stop are the maximum passband and
...
@@ -36,6 +36,12 @@
...
@@ -36,6 +36,12 @@
% interpolating a shorter filter with an upsampling factor Q. This
% interpolating a shorter filter with an upsampling factor Q. This
% reduces computation time substantially. N, L and Q must be powers of 2.
% reduces computation time substantially. N, L and Q must be powers of 2.
%
%
% The FIR coefficients are normalized to fit in range +-1. Given that
% the impulse response has a sync pulse shape this implies that the
% largest coefficient is h_fir_max = 1. Most energy is passed on via
% the center tap and therefore the filter DC gain per poly phase
% h_fir_dc_gain is close to 1.
%
% For nof_bits>1, the FIR filter coefficients are quantized with
% For nof_bits>1, the FIR filter coefficients are quantized with
% nof_bits bits.
% nof_bits bits.
%
%
...
@@ -114,13 +120,20 @@ else
...
@@ -114,13 +120,20 @@ else
end
end
end
;
end
;
% normalization, scale coefficients to have DC response is 1
% normalize the coefficients to fit in range +-1
h_fir
=
h_fir
/
sum
(
h_fir
);
disp
(
sprintf
(
'pfir_coeff : Normalizing the PFIR coefficients to fit in range +-1.'
));
h_fir
=
h_fir
/
max
(
h_fir
);
h_fir_max
=
max
(
h_fir
);
% note: is 1 due to the normalization
h_fir_min
=
min
(
h_fir
);
h_fir_dc_gain
=
sum
(
h_fir
)
/
N
;
disp
(
sprintf
(
' . Maximum coefficient value : %f'
,
h_fir_max
));
disp
(
sprintf
(
' . Minimum coefficient value : %f'
,
h_fir_min
));
disp
(
sprintf
(
' . DC gain per polyphase : %f\n'
,
h_fir_dc_gain
));
% quantize the coeffients
% quantize the coeffients
if
nof_bits
>
0
if
nof_bits
>
0
disp
(
sprintf
(
'pfir_coeff : Quantizing FIR coefficients nof_bits = %d\n'
,
nof_bits
));
disp
(
sprintf
(
'pfir_coeff : Quantizing FIR coefficients nof_bits = %d\n'
,
nof_bits
));
h_fir
=
quantize
(
h_fir
,
max
(
h_fir
)
,
nof_bits
,
'half_away'
);
h_fir
=
quantize
(
h_fir
,
h_fir
_max
,
nof_bits
,
'half_away'
);
% note: h_fir_max is 1 due to the normalization
end
;
end
;
% output FIR coefficient
% output FIR coefficient
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment