Demo entry 6646335

213

   

Submitted by 321 on Oct 16, 2017 at 12:08
Language: Matlab. Code size: 935 Bytes.

    Len = length(frameData);
    R=zeros(1,order);
    A=zeros(order,order); %用于保存a(i,i) 定义零矩阵预测系数
    E=zeros(1,order);     %用于保存E(i)
    k = zeros(order, 1);  %用于保存K(i)定义0矩阵反射系数pc
    %计算其他的r值
    for j=1:order	%计算自相关系数R的矩阵
        for n=j:Len-1
            R(j)=R(j)+frameData(n+1)*frameData(n-j+1);
        end
    end
    Ret= frameData' * frameData;%求R(0)
    %计算k(1)和r(1)
    k(1)=R(1)/ Ret; %计算反射函数
    A(1,1) = k(1); %计算预测函数
    E(1) = (1 - (k(1)^2)) * Ret;
    %计算从2到20 的K和R
    for i=2:order
        temp = 0;
        for j=1:i-1
            temp = temp + A(i-1,j)*R(i-j);
        end
        k(i) = (R(i) - temp) / E(i-1);
        A(i,i)=k(i);
        for j=1:i-1
            A(i,j)=A(i-1,j)-k(i)*A(i-1,i-j);
        end
        E(i)=(1-k(i)^2)*E(i-1);
    end
    b=-A(order,:);
    G(nframe) = sqrt(E(order))*2620;         % gain
    ai(:,nframe) =b';                   % a1,a2,...,a20
end

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).