fm_dsm.m

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

M
60
字号
function [y,iflaw]=fm_dsm(T1,T2,fnormi,fnormf);
%   FM_DSM	Signal with dissymmetrical linear frequency modulation.
%	[Y,IFLAW]=FM_DSM(T,FNORMI,FNORMF) generates a linear frequency  
%	modulation.
%	T1       : number of the first part's points
%	T1       : number of the first part's points
%	FNORMI  : initial normalized frequency (default: 0.0)
%	FNORMF  : final   normalized frequency (default: 0.5)
%	Y       : signal
%	IFLAW   : instantaneous frequency law  (optional).
%
%	Example : 
%	 [z,iflaw]=fm_dsm(128,64,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|nargin == 1),
 error ( 'The number of parameters must be at least 2.' );
elseif (nargin == 2), 
 fnormi=0.0; fnormf=0.5; 
elseif (nargin == 3),
 fnormf=0.5;
end;

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

⌨️ 快捷键说明

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