fm_v.m

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

M
57
字号
function [y,iflaw]=fm_v(T,fnormi,fnormf);
%   FM_V	Signal with V frequency modulation.
%	[Y,IFLAW]=FM_V(T,FNORMI,FNORMF) generates a linear frequency  
%	modulation.
%	T       : 2T is number of points
%	FNORMI  : initial normalized frequency (default: 0.0)
%	FNORMF  : final   normalized frequency (default: 0.5)
%	Y       : signal
%	IFLAW   : instantaneous frequency law  (optional).
%
%	Example : 
%	 z=fm_v(128,0.05,0.3); 
%	 plot(real(z));
%
%	see also FMCONST, FMSIN, FMODANY, FMHYP, FMPAR, FMPOWER.

%	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 ( 'The number of parameters must be at least 1.' );
elseif (nargin == 1),
 fnormi=0.0; fnormf=0.5; 
elseif (nargin == 2),
 fnormf=0.5;
end;

if (T <= 0),
 error ('The signal length 2T must be strictly positive' );
elseif (abs(fnormi) > 0.5) | (abs(fnormf) > 0.5),
 error ( 'fnormi and fnormf must be between -0.5 and 0.5' ) ;
else
 t = (1:T)';
 iflaw1(t+T) = fnormi + ((fnormf-fnormi)/(T-1)) * (t-1);
 iflaw1(-t+T+1)= fnormi + ((fnormf-fnormi)/(T-1)) * (t-1); 
 
 phase=cumsum(iflaw1);
 y=exp(j*2*pi*phase).'; 
 if (nargout==2), 
 iflaw=iflaw1';
  end;
end

⌨️ 快捷键说明

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