34 lines
771 B
Matlab
34 lines
771 B
Matlab
function yout = applyPulseShaping(xin,fsym,fdac)
|
|
|
|
if ~rem(fdac,fsym)
|
|
%ist ein Vielfaches
|
|
sps = fdac / fsym;
|
|
up = sps;
|
|
dn = 1;
|
|
else
|
|
%ist kein Vielfaches
|
|
up = fdac / gcd(fdac, fsym);
|
|
dn = fsym / gcd(fdac, fsym);
|
|
sps= up;
|
|
end
|
|
|
|
%Bau das Filter (hier rrc)
|
|
racos_len = 32;
|
|
alpha = 0.05;
|
|
h = rcosdesign(alpha,racos_len,sps);
|
|
|
|
%Apply Filter using Matlab build in fctn.
|
|
yout = upfirdn(xin,h,up,dn);
|
|
|
|
%cut signal, which is longer due to fir filter
|
|
st = round(up/dn*racos_len/2); %we need to cut y_out
|
|
en = round(st + (length(xin)*up/dn) -1);
|
|
|
|
yout = yout(st:en);
|
|
|
|
%Check output integrity
|
|
if round(up/dn * length(xin)) ~= length(yout)
|
|
warning('Check signal length after pulse shaping');
|
|
end
|
|
|
|
end |