Chirp Signal Generator

Dependencies:   mbed

Fork of TAU_ZOOLOG_Playback_Rev1_1 by Yossi_Students

Matlab_Script/HighPassFilterDesign.txt

Committer:
Arkadi
Date:
2019-06-20
Revision:
24:88c0f532b436
Parent:
15:155cd378c3d1

File content as of revision 24:88c0f532b436:

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