Tau ReSpeaker Setup V01

Dependencies:   MbedJSONValue mbed

Fork of TAU_ReSpeaker_DSP_Test by Yossi_Students

Matlab_Script/HighPassFilterDesign.txt

Committer:
Arkadi
Date:
2018-08-28
Revision:
12:9d30df1529be
Parent:
1:574b54755983

File content as of revision 12:9d30df1529be:

function [Hd, SOS, G] = HighPassFilterDesign(FilterFs,Fc, FilterOrder, RipplePass, RippleStop, FilterType)
% On the base of https://www.youtube.com/watch?v=crRNF8JjzIs
%
%Filter design
% Biquad Direct Form 1

Wn = (2/FilterFs)*Fc;
% design a second order filter:

if strcmp(FilterType,'butter')
    [z,p,k] = butter(FilterOrder,Wn,'high');
    [SOS,G] = zp2sos(z,p,k);
    Hd = dfilt.df1sos(SOS,G);
else
    if strcmp(FilterType,'cheby2')
        [z,p,k] = cheby2(FilterOrder,RippleStop, Wn, 'high');
        [SOS,G] = zp2sos(z,p,k);
        Hd = dfilt.df1sos(SOS,G);
    else
        if strcmp(FilterType,'ellip')
            [z,p,k]=ellip(FilterOrder,RipplePass,RippleStop,Wn,'high');
            [SOS,G] = zp2sos(z,p,k);
            Hd = dfilt.df1sos(SOS,G);
            
        else
            error('WRONG PARAMETER!!! Stop execution!');
            quit
        end
    end
end
end