⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dir2fs.m

📁 the file contain many matlab signal source code and many example .
💻 M
字号:
function [C,B,A]=dir2fs(h);
% Direct form to Frequency Sampling form conversion
% ---------------------------
% [C,B,A]=dir2fs(h)
% C=Row vector containing gains for parallel sections
% B=Matrix containing numerator coefficients arranged in rows
% A=Matrix containing denominator coefficients arranged in rows
% h=impulse response vector of an FIR filter
%
M=length(h);
N=fft(h,M);
magH=abs(N);phaH=angle(N)';
% check even or odd M
if (M==2*floor(M/2))
    L=M/2-1;% M is even 
    A1=[1,-1,0;1,1,0];
    C1=[real(N(1)),real(N(L+2))];
else
    L=(M-1)/2;% M is odd
    A1=[1,-1,0];
    C1=[real(N(1))];
end
k=[1:L]';
% initialize B and A arrays
B=zeros(L,2);A=ones(L,3);
% compute denominator coefficients
A(1:L,2)=-2*cos(2*pi*k/M);A=[A;A1];
% compute numerator coefficients
B(1:L,1)=cos(phaH(2:L+1));
B(1:L,2)=-cos(phaH(2:L+1)-(2*pi*k/M));
% compute gain coefficients
C=[2*magH(2:L+1),C1]';

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -