From df3ff8a622337ea552827742e51b80399c638bc6 Mon Sep 17 00:00:00 2001 From: Renaud Gonce <renaud.gonce@student.uclouvain.be> Date: Fri, 12 Jun 2020 21:40:38 +0200 Subject: [PATCH] Add new file --- LPF.m | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 LPF.m diff --git a/LPF.m b/LPF.m new file mode 100644 index 0000000..4cddea3 --- /dev/null +++ b/LPF.m @@ -0,0 +1,22 @@ +function [h] = LPF(type, fcut, reso, Nper) + +Tb = 1e-06; +M = reso*Nper; + +Ham = 0.54 - 0.46*cos( (2*pi*(0:M))/M ); +Black = 0.42 - 0.5*cos( (2*pi*(0:M))/M ) + 0.08*cos( (4*pi*(0:M))/M ); + +sinc_trunc = sin((fcut*2*pi*((0:M)/(M/Nper)-Nper/2)*Tb)) ./ (fcut*2*pi*((0:M)/(M/Nper)-Nper/2)*Tb); +sinc_trunc(isnan(sinc_trunc)) = 1; + + +if (strcmp(type,'Hamming')) + h = Ham.*sinc_trunc; +elseif (strcmp(type, 'Blackman')) + h = Black.*sinc_trunc; +else + fprintf('Error: this window type is not implemented!'); +end + + +end \ No newline at end of file -- GitLab