get_psfilter.m

来自「国外大学的同志作出来的好程序」· M 代码 · 共 38 行

M
38
字号
function ps_filter=get_psfilter(sim);
%get pulse shaping filters for disk
%in case, some machines don't have Communications Toolbox,
%or by rcosine function.
%
a=ver;
comm_version=0;
for ic=1:size(a, 2),
    if (strcmp(a(ic).Name, 'Communications Toolbox')),
        comm_version=str2num(a(ic).Version);
        %disp(['[get_psfilter]This matlab has Communication Toolbox, Version:' a(ic).Version '.']);
    end
end

%load preset value.
if comm_version<3;
    disp('[get_psfilter]Only two types of filters: root_raised_cosine/alpha=.5/grp_delay=10 and square/grp_delay=0')
    load ps_filters
    ps_filter=ps_filter_sqrt;
    return;
end

upsampling_rate=sim.sampling_rate/sim.symbol_rate;
%use Matlab Communication Toolbox.
if comm_version>=3
    ps_type=sim.pulse_shaping_type;
    ps_alpha=sim.ps_alpha;
    ps_grp_delay=sim.ps_grp_delay;
    ps_filter_sqrt=rcosine(1, upsampling_rate, ps_type, ps_alpha, ps_grp_delay);
    save ps_filters ps_filter_sqrt
    ps_filter=ps_filter_sqrt;
end

if strcmp(sim.pulse_shaping_type,'rect'),
    ps_filter=ones(upsampling_rate, 1);
    disp('[get_psfilter]For rect pulse, other parameters ignored.');
end

⌨️ 快捷键说明

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