diric
狄利克雷或周期性正弦函数
说明
示例
计算并绘制狄利克雷函数在 和 之间(对于 N = 7 和 N = 8)的图。对于奇数 N,该函数的周期为 ,对于偶数 N,周期为 。
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')

狄利克雷和正弦函数的相关性表示为 。显示 时的此关系。通过将正弦函数的比率指定为 (对于 ,其中 是整数)来避免不确定表达式。
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; 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 是按元素运算。
数据类型: double | single
函数次数,指定为正整数标量。
数据类型: double | single
详细信息
对于任何非零整数 N,狄利克雷函数(或周期性正弦函数)是
。
对于奇数 N,此函数的周期为 2π,对于偶数 N,周期为 4π。对于所有 N,其最大值为 1,对于偶数 N,其最小值为 -1。函数的幅值是 1/N 乘以长度为 N 个点的矩形窗的离散时间傅里叶变换的幅值。
扩展功能
C/C++ 代码生成
使用 MATLAB® Coder™ 生成 C 代码和 C++ 代码。
GPU 代码生成
使用 GPU Coder™ 为 NVIDIA® GPU 生成 CUDA® 代码。
版本历史记录
在 R2006a 之前推出
MATLAB Command
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 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)