📄 sinc2.m
字号:
function y = sinc2(x)
% SINC2 Sinc-squared Function.
%
% Y=SINC2(X) generates [sin(pi*x)/(pi*x)]^2
%
% SINC2 (with no input arguments) invokes the following example:
%
% % Compare and plot sinc(t) and sinc2(t) over -3 to 3
% >>t=-3:.02:3;
% >>ys=sinc(t);
% >>ys2=sinc2(t);
% >>plot(t,ys,t,ys2)
% >>grid
% 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 sinc2
disp('Strike a key to see results of the example')
pause
t=-3:.02:3;
ys=sinc(t);
ys2=sinc2(t);
v=matverch;
if v < 4, eval('clg');else,eval('clf');end
plot(t,ys,t,ys2)
grid
return
end
if nargin == 1,
y=sinc(x);
% x=pi*x;
% i=find(x==0);
% [m,n]=size(i);
% x(i)=ones(m,n);
% y=sin(x)./x;
% y(i)=ones(m,n);
y=y.*y;
elseif nargin > 1,
error('Too many input arguments');
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -