📄 normalizef.m
字号:
function [F,varargout]=NormalizeF(F,G)
% NormalizeF Normalize the synthesis vectors in frame F
%
% F=NormalizeF(F);
% [F,nf]=NormalizeF(F,G);
%-----------------------------------------------------------------------------------
% arguments:
% F the frame, a NxKxP matrix or a Qx1 vector
% as input argument it is "unnormalized" values
% as output argument it is "normalized" values
% G the mapping matrix, size NxKxP if F is a Qx1 vector, else G=[]
% or G may be omitted
% nf the normalization factors, for each of the K synthesis vectors
% in the frame the frame vector is updated like: F(:,k)=F(:,k)/nf(k);
%-----------------------------------------------------------------------------------
%----------------------------------------------------------------------
% Copyright (c) 2001. Karl Skretting. All rights reserved.
% Hogskolen in Stavanger (Stavanger University), Signal Processing Group
% Mail: karl.skretting@tn.his.no Homepage: http://www.ux.his.no/~karlsk/
%
% HISTORY: dd.mm.yyyy
% Ver. 1.0 04.10.2001 KS: function made
% Ver. 1.1 25.11.2002 KS: moved from ..\Frames to ..\FrameTools
%----------------------------------------------------------------------
Mfile='NormalizeF';
if (nargin<1)
error([Mfile,': wrong number of arguments, see help.']);
end
if (nargin<2); G=[]; end;
if length(G)==0
[N,K,P]=size(F);
Fb=F;
Q=0;
else
[N,K,P]=size(G);
Q=length(F);
Fb=BuildFg(F,G);
end
if P>1
% reshape frame into K vectors of length NP
Fb=reshape(permute(Fb,[1,3,2]),N*P,K);
end
% normalize each of these
nf=ones(K,1);
for k=1:K; % now normalize Fb
temp=Fb(:,k)'*Fb(:,k);
if (temp > 0); nf(k)=sqrt(temp); end;
if sum(Fb(:,k))<0; nf(k)=-nf(k); end;
Fb(:,k)=Fb(:,k)/nf(k);
end
if P>1
% rearrange Fb into size NxKxP
Fb=permute(reshape(Fb,N,P,K),[1,3,2]);
end
% now find F from G and Fb (or only from Fb)
if Q==0
F=Fb;
else
for q=1:Q
I=find(G(:)==q);
F(q)=Fb(I(1));
end
end
if nargout==2
varargout(1)={nf};
end
return
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -