MATLAB 帮助中心
狄利克雷或周期性正弦函数
y = diric(x,n)
y = diric(x,n) 返回在输入数组 x 的元素处计算的次数为 n 的狄利克雷函数。
y
x
n
示例
全部折叠
计算并绘制狄利克雷函数在 -2π 和 2π 之间(对于 N = 7 和 N = 8)的图。对于奇数 N,该函数的周期为 2π,对于偶数 N,周期为 4π。
x = linspace(-2*pi,2*pi,301); d7 = diric(x,7); d8 = diric(x,8); subplot(2,1,1) plot(x/pi,d7) ylabel('N = 7') title('Dirichlet Function') subplot(2,1,2) plot(x/pi,d8) ylabel('N = 8') xlabel('x / \pi')
狄利克雷和正弦函数的相关性表示为 DN(πx)=sinc(Nx/2)/sinc(x/2)。显示 N=6 时的此关系。通过将正弦函数的比率指定为 (-1)k(N-1)(对于 x=2k,其中 k 是整数)来避免不确定表达式。
xmax = 4; x = linspace(-xmax,xmax,1001)'; N = 6; yd = diric(x*pi,N); ys = sinc(N*x/2)./sinc(x/2); ys(~mod(x,2)) = (-1).^(x(~mod(x,2))/2*(N-1)); subplot(2,1,1) plot(x,yd) title('D_6(x*pi)') subplot(2,1,2) plot(x,ys) title('sinc(6*x/2) / sinc(x/2)')
重复 N=13 的计算。
N = 13; yd = diric(x*pi,N); ys = sinc(N*x/2)./sinc(x/2); ys(~mod(x,2)) = (-1).^(x(~mod(x,2))/2*(N-1)); subplot(2,1,1) plot(x,yd) title('D_{13}(x*pi)') subplot(2,1,2) plot(x,ys) title('sinc(13*x/2) / sinc(x/2)')
输入数组,指定为实数标量、向量、矩阵或 N 维数组。当 x 为非标量时,diric 是按元素运算。
diric
数据类型: double | single
double
single
函数次数,指定为正整数标量。
输出数组,以实数值标量、与 x 大小相同的向量、矩阵或 N 维数组形式返回。
对于任何非零整数 N,狄利克雷函数(或周期性正弦函数)是
DN(x)={sin(Nx/2)Nsin(x/2)x≠2πk, k=0,±1,±2,±3,...(−1)k(N−1)x=2πk, k=0,±1,±2,±3,...
。
对于奇数 N,此函数的周期为 2π,对于偶数 N,周期为 4π。对于所有 N,其最大值为 1,对于偶数 N,其最小值为 -1。函数的幅值是 1/N 乘以长度为 N 个点的矩形窗的离散时间傅里叶变换的幅值。
全部展开
在 R2006a 之前推出
cos | gauspuls | pulstran | rectpuls | sawtooth | sin | sinc | square | tripuls
cos
gauspuls
pulstran
rectpuls
sawtooth
sin
sinc
square
tripuls
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
欧洲
亚太
联系您当地的办事处