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

📄 fmtan.m

📁 matlab下的有用的时频分析工具箱
💻 M
字号:
function [y,iflaw]=fmtan(N,k,fnorm0,fnormax);
%FMtan	Signal with tangential frequency modulation.
%	[Y,IFLAW]=FMTAN(N,K,FNORM0,FNORMAX)
%	generates a frequency modulation with a tangential frequency.

%	N       : number of points.
%   k       : cofficient of frequency modulation     (default: 0.5)
%	FNORM0  : lowest frequency                       (default:0.0)
%   FNORMAX : highest frequency                      (default:0.5)
%	Y       : signal
%	IFLAW   : its instantaneous frequency law (optional).
%
%	Example: 
%	 [z,iflaw]=fmtan(256,0.8,0,0.5);plot(iflaw);
%
%	See also FMCONST, FMLIN, FMODANY, FMHYP, FMPAR, FMPOWER,FMSIN.

%	F. Auger, 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 1 parameter required' ) ;
elseif (nargin == 1),
 k=0.5;fnorm0=0;fnormax=0.5;
elseif (nargin == 2),
 fnorm0=0;fnormax=0.5;
elseif (nargin == 3),
 fnormax=0.5; 
end;

if (N <= 0),
 error ('The signal length N must be strictly positive' );
elseif (fnorm0<0|fnormax>0.5),
 error (' fnorm0 must higher than 0 and fnormax must lower than 0.5') ;
elseif (k <=0|k>=1),
 error (' k must be between 0 and 1') ;
else
 f0=(fnormax+fnorm0)/2;
 B=fnormax-fnorm0;
 w=B/(2*tan(k*pi/2));
 time=(1:N)-N/2;
 phase=2*pi*f0*(time+N/2)-2*w*N/k*(log2(cos(k*pi/N*(time))));
 y = exp(j*phase).';
 if (nargout==2)
  iflaw=f0+w*tan(k*pi/N*(time));
 end
end

⌨️ 快捷键说明

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