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

📄 fmstep.asv

📁 matlab下的有用的时频分析工具箱
💻 ASV
字号:
function y=fmstep(N,N0,Tp,fnormi,fnormf,t0);
%FMLIN	Signal with linear frequency modulation.
%	Y=FMLIN(N,FNORMI,FNORMF,T0) generates a linear frequency  
%	modulation.
%	The phase of this modulation is such that Y(T0)=1.
%
%	N       : number of points
%   N0      : number of impulses           (default: 4)
%   Tp      : width  of impulse            (default: N/(N0*2))
%	FNORMI  : initial normalized frequency (default: 0.0)
%	FNORMF  : final   normalized frequency (default: 0.5)
%	T0      : time reference for the phase (default: Tp/2).
%	Y       : signal
%	
%	Example : 
%	 z=fmstep(1024,4,200,0.05,0.5,100); 
%	 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),
 N0=4;Tp=round(N/(N0*2));fnormi=0.0; fnormf=0.5; t0= round(Tp/2);
elseif (nargin == 2),
 Tp=round(N/(N0*2));fnormi=0.0; fnormf=0.5; t0= round(Tp/2);
elseif (nargin == 3),
 fnormi=0.0; fnormf=0.5; t0= round(Tp/2);
elseif (nargin == 4),
 fnormf=0.5; t0= round(Tp/2); 
elseif (nargin == 5),
 t0= round(Tp/2); 
end;

if (N <= 0),
 error ('The signal length N 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' ) ;
elseif Tp>(N/N0),
  error ( 'Tp must lower than (N/N0)' ) ;  
else
    
 step=(fnormf-fnormi)/N0;
 k=step/(Tp-1); 
 for i=0:(N0-1) 
 for t = (1+i*N/N0):(Tp+i*N/N0)
 x(t) = (fnormi+i*step)*(t-i*N/N0-t0) + (k/2) * ((t-i*N/N0-1).^2 - (t0-1).^2);
 y(t) = exp(j*2.0*pi*x(t)) ;
 end
 for t= (Tp+i*N/N0+1):((1+i)*N/N0)
 y(t)=0;
 end
 end
 y=y.';
 if (nargout==2)
 for i=0:(N0-1) 
 for t = (1+i*N/N0):(Tp+i*N/N0)
 iflaw(t) = (fnormi+i*step)*(t-i*N/N0-t0) + (k/2) * ((t-i*N/N0-1).^2 - (t0-1).^2);
 end
 for t= (Tp+i*N/N0+1):((1+i)*N/N0)
 y(t)=0;
 end
 end
 end
end

 

⌨️ 快捷键说明

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