📄 iir2fir.m
字号:
function g=iir2fir(g,L,symmetri);%IIR2FIR Cut IIR window to FIR% Usage: g=iir2fir(g,L);%% IIR2FIR(g,L) will cut the IIR window g to a length L FIR window by% cutting out the middle part. Note that this is a slightly different% behaviour than MIDDLEPAD.%% IIR2FIR(g,L,'wpe') or IIR2FIR(g,L,'hpe') does the same assuming the input% window is a WPE or HPE window, respectively.%% SEE ALSO: FIREXTEND, MIDDLEPAD% This program is free software: you can redistribute it and/or modify% it under the terms of the GNU General Public License as published by% the Free Software Foundation, either version 3 of the License, or% (at your option) any later version.% % This program is distributed in the hope that it will be useful,% but WITHOUT ANY WARRANTY; without even the implied warranty of% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% GNU General Public License for more details.% % You should have received a copy of the GNU General Public License% along with this program. If not, see <http://www.gnu.org/licenses/>.error(nargchk(2,3,nargin));W=length(g);if W<L error('L must be smaller than length of window.');end;if nargin==2 % No assumption on the symmetri of the window. if rem(L,2)==0 % HPE middlepad works the same way as the FIR cutting (e.g. just % removing middle points) for even values of L. g=middlepad(g,L,[],.5); else % WPE middlepad works the same way as the FIR cutting (e.g. just % removing middle points) for odd values of L. g=middlepad(g,L); end; else switch(lower(symmetri)) case 'wpe' g=middlepad(g,L); if rem(L,2)==0 g(L/2+1)=0; end; case 'hpe' g=middlepad(g,L,[],.5); if rem(L,2)==1 g(ceil(L/2))=0; end; otherwise error('Unknown symmetri.'); end;end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -