📄 pulseshape.m
字号:
function [s,t]=pulseshape(indata,fs,pulsetype,T)% [s,t]=pulseshape(indata,fs,pulsetype,T)%% Output:% s - Symbols after pulsshaping and upsampling% t - Time%% Input:% indata - BPSK-modulated% fs - Samplefrequency% pulsetype - Decides which pulsform to be used% pulsetype=1 => square % pulsetype=2 => rootraisedcosine% pulsetype=3 => hamming% pulsetype=4 => raisedcosine% T - Symbolperiod%% Short Theoretical Background for the Function:% % Upsamples indata by a factor of oversamp by insertion of oversamp-1 zeros % and applies pulse shaping with a pulsshape according to the variable pulsetype.% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% Function part of simulation for Space-Time%%% coding project, group Grey-2001.%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Author: Fredrik Hansson% Date:2001-03-19% Version:1.0% Revision (Name & Date): FH and SU 21/3% 1.1 SU 20010406 Added option: pulsetype=4 for Raised-Cosine pulseform.%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%oversamp = fs*T;L = length(indata);if pulsetype == 1 % choose pulsetype p = ones(1,oversamp)/sqrt(oversamp);elseif pulsetype == 2 p = root_raised_cosine(oversamp);elseif pulsetype == 3 p = hamming(oversamp)';elseif pulsetype == 4 p = raised_cosine(oversamp);end%%%%%% Zero insertion:%%%data_with_zeros = zeros(1,oversamp*L);data_with_zeros(1:oversamp:end) = indata; %%%%%% Filter with selected pulsetype, using convolution:%%%s = conv(p,data_with_zeros);t = 0:T/oversamp:(L*T-T/oversamp); % upsampled time scale
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -