📄 comp_pgauss.m
字号:
function [g]=comp_pgauss(L,w,center)%COMP_PGAUSS Sampled, periodized Gaussian.% % Computational routine: See help on PGAUSS.%% center=0 gives whole-point centered function.% center=.5 gives half-point centered function.%% Does not check input parameters, do not call this% function directly.% 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 3 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, see <http://www.gnu.org/licenses/>.% Author : Peter Soendergaard.if prod(size(center))==1 c_t=center; c_f=0;else c_t=center(1); c_f=center(2);end;% c_t - time centering% c_f - frequency centeringg=zeros(L,1);sqrtl=sqrt(L);safe=4;% Outside the interval [-safe,safe] then exp(-pi*x.^2) is numerically zero.nk=ceil(safe/sqrt(L/sqrt(w)));lr=(0:L-1).';for k=-nk:nk g=g+exp(-pi*((lr+c_t)/sqrtl-k*sqrtl).^2/w-2*pi*i*c_f*(lr/L-k));end;% Normalize it exactly.g=g/norm(g);% This normalization is only approximate%g=g*(w*L/2)^(-.25);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -