📄 xfir_filt
字号:
str="string spec3_hug ="'"not hugged";' echo $str >> $donefile str="string spec3_interp ="'"arithmetic";' echo $str >> $donefile str="string spec4_hug ="'"not hugged";' echo $str >> $donefile str="string spec4_interp ="'"arithmetic";' echo $str >> $donefile echo " " >> $donefile str="int nspec =4;" echo $str >> $donefile str="int nspec_pushed = 2;" echo $str >> $donefile str="int spec1_pushed = 4;" echo $str >> $donefile str="int spec2_pushed = 3;" echo $str >> $donefile if test x$paramfile != x then cp $donefile $paramfile fi cb_filt -P$donefile $outfile filtspec -ml $outfile - |plotspec - & fi#--------CONSTRAINT-BASED HILBERT TRANSFORMER if test $filt_type = 'HILBERT' then echo "Can't do Hilbert transformer filter with constraint-based design" exit fifiif test $filt_mthd = 'EQUI_RIPPLE'then#--------EQUIRIPPLE LOWPASS----------------- if test $filt_type = 'LOWPASS' then cat >> $queryfile << END string filt_type = "multiband": "Desired FIR kind:":{"MULTIBAND", "DIFFERENTIATOR", "HILBERT"}; float samp_freq ?= 8000; int filt_length ?= 33: "Filter length:"; int nbands = 2: "Number of bands:"; float band1_edge1 ?= 0: "Left bandedge for band 1:"; float band1_edge2 ?= 1600: "Right bandedge for band 1:"; float band1_des ?= 1: "Value for band 1, or slope for differentiator"; float band1_wt ?= 1: "Weight for band 1"; float band2_edge1 ?= 2000: "Left bandedge for band 2:"; float band2_edge2 ?= 4000: "Right bandedge for band 2:"; float band2_des ?= 0: "Value for band 2"; float band2_wt ?= 1: "Weight for band2";END exprompt -X10 -Y10 -P $queryfile -h pkmc_filt $donefile if test x$paramfile != x then cp $donefile $paramfile fi pkmc_filt -P$donefile $outfile filtspec -ml $outfile - |plotspec - & fi#--------EQUIRIPPLE HIGHPASS----------------- if test $filt_type = 'HIGHPASS' then cat >> $queryfile << END string filt_type = "multiband": "Desired FIR kind:":{"MULTIBAND", "DIFFERENTIATOR", "HILBERT"}; float samp_freq ?= 8000; int filt_length ?= 33: "Filter length:"; int nbands = 2: "Number of bands:"; float band1_edge1 ?= 0: "Left bandedge for band 1:"; float band1_edge2 ?= 1600: "Right bandedge for band 1:"; float band1_des ?= 0: "Value for band 1, or slope for differentiator"; float band1_wt ?= 1: "Weight for band 1"; float band2_edge1 ?= 2000: "Left bandedge for band 2:"; float band2_edge2 ?= 4000: "Right bandedge for band 2:"; float band2_des ?= 1: "Value for band 2"; float band2_wt ?= 1: "Weight for band2";END exprompt -X10 -Y10 -P $queryfile -h pkmc_filt $donefile if test x$paramfile != x then cp $donefile $paramfile fi pkmc_filt -P$donefile $outfile filtspec -ml $outfile - |plotspec - & fi#--------EQUIRIPPLE MULTIBAND ------------------- if test $filt_type = 'MULTIBAND' then str='int filt_length ?= 16:"filter length";' echo $str >> $queryfile for i in $cnt do if test $i -le $nbands then str="float band"$i"_edge1 ?= 0.0: "'"left edge for band '$i'";' echo $str >> $queryfile str="float band"$i"_edge2 ?= 0.0: "'"right edge for band '$i'";' echo $str >> $queryfile str="float band"$i"_des ?= 1: "'"desired value for band '$i'";' echo $str >> $queryfile str="float band"$i"_wt ?= 1: "'"weight for band '$i'";' echo $str >> $queryfile fi done str='string filt_type = "MULTIBAND";' echo $str >> $queryfile str="float samp_freq = $samp_freq;" echo $str >> $queryfile str="int nbands = $nbands;" echo $str >> $queryfile exprompt -X10 -Y10 -P $queryfile -h pkmc_filt $donefile if test x$paramfile != x then cp $donefile $paramfile fi pkmc_filt -P$donefile $outfile filtspec -ml $outfile - |plotspec - & fi#--------EQUIRIPPLE DIFFERENTIATOR if test $filt_type = 'DIFFERENTIATOR' then str='int filt_length ?= 21:"filter length";' echo $str >> $queryfile str='float band1_edge2 ?= 2000:" Differentor passband frequency:";' echo $str >> $queryfile str='float band2_edge1 ?= 3200:" Differentor stopband frequency:";' echo $str >> $queryfile str='float band1_des ?= 1:" Differentor passband slope:";' echo $str >> $queryfile str='float band1_wt ?= 1:" Differentor passband weight:";' echo $str >> $queryfile str='float band2_wt ?= 1:" Differentor stopband weight:";' echo $str >> $queryfile str='string filt_type = "DIFFERENTIATOR";' echo $str >> $queryfile str="float samp_freq = $samp_freq;" echo $str >> $queryfile str="int nbands = 2;" echo $str >> $queryfile str='float band1_edge1 = 0.0;' echo $str >> $queryfile nyquist=`echo $samp_freq \/ 2 | bc` str="float band2_edge2 = $nyquist;" echo $str >> $queryfile str='float band2_des = 0.0;' echo $str >> $queryfile exprompt -X10 -Y10 -P $queryfile -h pkmc_filt $donefile if test x$paramfile != x then cp $donefile $paramfile fi pkmc_filt -P$donefile $outfile filtspec -ml $outfile - |plotspec - & fi#--------EQUIRIPPLE HILBERT TRANSFORMER if test $filt_type = 'HILBERT' then str="int filt_length ?= 41:"'"filter length";' echo $str >> $queryfile str="float samp_freq = $samp_freq;" echo $str >> $queryfile str='string filt_type = "HILBERT";' echo $str >> $queryfile str="int nbands = 1;" echo $str >> $queryfile str='float band1_edge1 = 0.0;' echo $str >> $queryfile str='float band1_edge2 = 4000;' echo $str >> $queryfile str='float band1_des = 1;' echo $str >> $queryfile str='float band1_wt = 1;' echo $str >> $queryfile exprompt -X10 -Y10 -P $queryfile -h pkmc_filt $donefile if test x$paramfile != x then cp $donefile $paramfile fi pkmc_filt -P$donefile $outfile filtspec -ml $outfile - |plotspec - & fifiif test $filt_mthd = 'WEIGHTED_MS'then#--------WEIGHTED MEAN-SQUARED LOWPASS --------- if test $filt_type = 'LOWPASS' then cat >> $queryfile << END float samp_freq ?= 8000: "Sampling frequency:"; int filt_length ?= 201: "filter length - odd:"; int nbands = 2: "Number of bands:"; float band_edge1 ?= 0; float band_edge2 ?= 1800; float band_edge3 ?= 4000; float band1_des ?= 1: "desired value for band1:"; float band2_des ?= 0: "desired value for band2:"; float band1_wt ?= 1: "weighting value for band1:"; float band2_wt ?= 1: "weighting value for band2:";END exprompt -X10 -Y10 -P $queryfile -h wmse_filt $donefile if test x$paramfile != x then cp $donefile $paramfile fi wmse_filt -P$donefile $outfile filtspec -ml $outfile - |plotspec - & fi#--------WEIGHTED MEAN-SQUARED HIGHPASS --------- if test $filt_type = 'HIGHPASS' then cat >> $queryfile << END float samp_freq ?= 8000: "Sampling frequency:"; int filt_length ?= 201: "filter length - odd:"; int nbands = 2: "Number of bands:"; float band_edge1 ?= 0; float band_edge2 ?= 1800; float band_edge3 ?= 4000; float band1_des ?= 0: "desired value for band1:"; float band2_des ?= 1: "desired value for band2:"; float band1_wt ?= 1: "weighting value for band1:"; float band2_wt ?= 1: "weighting value for band2:";END exprompt -X10 -Y10 -P $queryfile -h wmse_filt $donefile if test x$paramfile != x then cp $donefile $paramfile fi wmse_filt -P$donefile $outfile filtspec -ml $outfile - |plotspec - & fi#--------WEIGHTED MEAN-SQUARED MULTIBAND ------------------- if test $filt_type = 'MULTIBAND' then str='int filt_length ?= 201:"filter length (odd number)";' echo $str >> $queryfile for i in $cnt do if test $i -le $nbands then str="float band"$i"_des ?= 1: "'"desired value for band '$i'";' echo $str >> $queryfile str="float band"$i"_wt ?= 1: "'"weight for band '$i'";' echo $str >> $queryfile fi done nbands1=`echo "1 $nbands + p q"|dc` for i in $cnt do if test $i -le $nbands1 then str="float band_edge"$i" ?= 0.0: "'"the '$i'th bandedge";' echo $str >> $queryfile fi done str="float samp_freq = $samp_freq;" echo $str >> $queryfile str="int nbands = $nbands;" echo $str >> $queryfile exprompt -X10 -Y10 -P $queryfile -h wmse_filt $donefile if test x$paramfile != x then cp $donefile $paramfile fi wmse_filt -P$donefile $outfile filtspec -ml $outfile - |plotspec - & fi if test $filt_type = 'DIFFERENTIATOR' then echo "Can't do differentiator filter with weighted-MS design" exit fi if test $filt_type = 'HILBERT' then echo "Can't do Hilbert transformer filter with weighted-MS design" exit fifiif test $filt_mthd = 'WINDOW_METH'then#--------WINDOW_METH LOWPASS ------------------- if test $filt_type = 'LOWPASS' then cat >> $queryfile << END float samp_freq ?= 8000: "Sampling frequency:"; int nbands = 2: "Number of bands:"; float band_edge1 ?= 0; float band_edge2 ?= 1800; float band_edge3 ?= 4000; float band1_des ?= 1: "desired value for band1:"; float band2_des ?= 0: "desired value for band2:"; float rej_db ?= 20: "rejection in dB from one band to another:"; float trans_band ?= 100: "transition bandwidth:";END exprompt -X10 -Y10 -P $queryfile -hwin_filt $donefile if test x$paramfile != x then cp $donefile $paramfile fi win_filt -P$donefile $outfile filtspec -ml $outfile - |plotspec - & fi#--------WINDOW_METH HIGHPASS ------------------- if test $filt_type = 'HIGHPASS' then cat >> $queryfile << END float samp_freq ?= 8000: "Sampling frequency:"; int nbands = 2: "Number of bands:"; float band_edge1 ?= 0; float band_edge2 ?= 1800; float band_edge3 ?= 4000; float band1_des ?= 0: "desired value for band1:"; float band2_des ?= 1: "desired value for band2:"; float rej_db ?= 20: "rejection in dB from one band to another:"; float trans_band ?= 100: "transition bandwidth:";END exprompt -X10 -Y10 -P $queryfile -hwin_filt $donefile if test x$paramfile != x then cp $donefile $paramfile fi win_filt -P$donefile $outfile filtspec -ml $outfile - |plotspec - & fi#--------WINDOW_METH MULTIBAND ------------------- if test $filt_type = 'MULTIBAND' then for i in $cnt do if test $i -le $nbands then str="float band"$i"_des ?= 1: "'"desired value for band '$i'";' echo $str >> $queryfile fi done nbands1=`echo "1 $nbands + p q"|dc` for i in $cnt do if test $i -le $nbands1 then str="float band_edge"$i" ?= 0.0: "'"the '$i'th bandedge";' echo $str >> $queryfile fi done str='float rej_db ?= 20:"rejction ratio in dB";' echo $str >> $queryfile str='float trans_band ?= 100:"transition bandwidth";' echo $str >> $queryfile str="float samp_freq = $samp_freq;" echo $str >> $queryfile str="int nbands = $nbands;" echo $str >> $queryfile exprompt -X10 -Y10 -P $queryfile -h win_filt $donefile if test x$paramfile != x then cp $donefile $paramfile fi win_filt -P$donefile $outfile filtspec -ml $outfile - |plotspec - & fi if test $filt_type = 'DIFFERENTIATOR' then echo "Can't do differentiator filter with windowing design" exit fi if test $filt_type = 'HILBERT' then echo "Can't do Hilbert transformer filter with windowing design" exit fifirm $queryfile rm $firkindfile rm $donefile
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -