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

📄 chirp.m

📁 很多matlab的源代码
💻 M
字号:
function y = chirp(f,N)
% CHIRP Generate a chirp signal.
%
%       Y=CHIRP(F,N) generates an N point chirped cosine over the digital
%       frequencies defined in F = [F1,F2]
%	The number of points N defaults to N=200 if not specified.
%       Note: max(F) must be < 0.5
%
%       CHIRP (with no input arguments) invokes the following example:
%
%         % To get 400 samples of a chirp signal between 5 and 25Hz in 2s
%         >>fc=[5 25];
%         >>fs=400/2;
%         >>x=chirp(fc/fs,400);
%         >>plot(x)
%
%      See Also: SINC2, UDELTA, PERTEXT, EVENODD, PSDWELCH


% ADSP Toolbox: Version 2.0 
% For use with "Analog and Digital Signal Processing", 2nd Ed.
% Published by PWS Publishing Co.
%
% Ashok Ambardar, EE Dept. MTU, Houghton, MI 49931, USA
% http://www.ee.mtu/faculty/akambard.html
% e-mail: akambard@mtu.edu
% Copyright (c) 1998


if nargin==0,
 help chirp
 disp('Strike a key to see results of the example')
 pause
 fc=[5 25];
 fs=400/2;
 x=chirp(fc/fs,400);
  v=matverch;
 if v < 4, eval('clg');else,eval('clf');end

 subplot
 plot(x)
 return
end

if nargin<2
N=200;
end
if nargin <3,
 if length(f)==1,
  f=[0 f];
 end
 fmax=max(f);
 b=f(2)-f(1);
 n=0:N-1;
 w=pi*sum(f);
 %z=n.*(sum(f)-b*(1-n/N));z=rem(z,2);y=cos(pi*z);
 y=cos(pi*n.*(sum(f)+b*(-N:-1)/N));
else
 error('Too many input arguments');
end

⌨️ 快捷键说明

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