Tau ReSpeaker Setup V01
Dependencies: MbedJSONValue mbed
Fork of TAU_ReSpeaker_DSP_Test by
Diff: Matlab_Script/HighPassFilterDesign.txt
- Revision:
- 1:574b54755983
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Matlab_Script/HighPassFilterDesign.txt Sun Feb 11 15:13:52 2018 +0000 @@ -0,0 +1,31 @@ +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 \ No newline at end of file