instfreq1.m

来自「matlab下的有用的时频分析工具箱」· M 代码 · 共 54 行

M
54
字号
function [fnormhat,t]=instfreq1(x);
%INSTFREQ1 Instantaneous frequency estimation.
%	[FNORMHAT,T]=INSTFREQ1(X) computes the instantaneous 
%	frequency of the analytic signal X at time instant(s) T, using the
%	trapezoidal(梯形的) integration rule.
%	The result FNORMHAT lies between 0.0 and 0.5.
% 
%	X : Analytic signal to be analyzed.
	
%	FNORMHAT : Output (normalized) instantaneous frequency.
%	T : Time instants.
%
%	Examples : 
%	 z=fmsin(70,0.05,0.35,25); [instf,t]=instfreq1(z); plot(t,instf)

%
%	See also  KAYTTH, SGRPDLAY.

%	F. Auger, March 1994, July 1995.
%	Copyright (c) 1996 by CNRS (France).
%
%  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 2 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, write to the Free Software
%  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

if (nargin == 0),
 error('At least one parameter required');
end;
[xrow,xcol] = size(x);
if (xcol~=1),
 error('X must have only one column');
end
t=2:xrow-1;
for i=2: xrow-1
     if (real(x(i-1))==0|real(x(i+1))==0)
     fnormhat(i-1)=0;
     else  fnormhat(i-1)=0.5*(angle(-x(i+1).*conj(x(i-1)))+pi)/(2*pi);
     end
 end;
 fnormhat= fnormhat';



⌨️ 快捷键说明

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