changes in pulsef
This commit is contained in:
@@ -50,7 +50,7 @@ classdef Pulseformer
|
||||
signalclass_in = signalclass_in.logbookentry(lbdesc);
|
||||
|
||||
% write fs to signal
|
||||
signalclass_in.fs = obj.fdac .* (obj.fdac./obj.fsym);
|
||||
signalclass_in.fs = obj.fdac;%.* (obj.fdac./obj.fsym);
|
||||
|
||||
% write to output
|
||||
signalclass_out = signalclass_in;
|
||||
@@ -80,13 +80,13 @@ classdef Pulseformer
|
||||
if ~rem(obj.fdac,obj.fsym)
|
||||
%ist ein Vielfaches
|
||||
sps = obj.fdac / obj.fsym;
|
||||
up = sps;
|
||||
dn = 1;
|
||||
p = sps;
|
||||
q = 1;
|
||||
else
|
||||
%ist kein Vielfaches
|
||||
up = obj.fdac / gcd(obj.fdac, obj.fsym);
|
||||
dn = obj.fsym / gcd(obj.fdac, obj.fsym);
|
||||
sps= up;
|
||||
p = obj.fsym / gcd(obj.fdac, obj.fsym); %upsampling p->->->
|
||||
q = obj.fdac/ gcd(obj.fdac, obj.fsym); %downsampling <-q
|
||||
sps= q; %sps während dem pulse shaping
|
||||
end
|
||||
|
||||
if obj.pulse == pulseform.rc
|
||||
@@ -123,7 +123,7 @@ classdef Pulseformer
|
||||
data_out = circshift(data_out,[0 -(obj.pulselength*sps)]);
|
||||
|
||||
if rem(obj.fdac,obj.fsym)
|
||||
data_out = data_out(1:dn:end);
|
||||
data_out = data_out(1:q:end);
|
||||
end
|
||||
|
||||
end
|
||||
@@ -132,11 +132,11 @@ classdef Pulseformer
|
||||
|
||||
%Apply Filter using Matlab build in fctn.
|
||||
|
||||
data_out_ = upfirdn(data_in,h,up,dn);
|
||||
data_out_ = upfirdn(data_in,h,p,q);
|
||||
|
||||
%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(data_in)*up/dn));
|
||||
st = round(p/q*racos_len/2); %we need to cut y_out
|
||||
en = round(st + (length(data_in)*p/q));
|
||||
data_out = data_out_(st:en);
|
||||
|
||||
end
|
||||
@@ -146,7 +146,7 @@ classdef Pulseformer
|
||||
subplot(2,1,1)
|
||||
title("Convolution vs. Upfirdn and Cut")
|
||||
hold on
|
||||
plot(data_out_(1:200),'DisplayName','Matlab upfirdn');
|
||||
% plot(data_out_(1:200),'DisplayName','Matlab upfirdn');
|
||||
plot(data_out(1:200),'DisplayName','By Hand cyclic convolution')
|
||||
subplot(2,1,2)
|
||||
hold on
|
||||
@@ -161,7 +161,7 @@ classdef Pulseformer
|
||||
data_out = data_out';
|
||||
|
||||
%Check output integrity
|
||||
if abs(round(up/dn * length(data_in)) - length(data_out)) > 4
|
||||
if abs(round(p/q * length(data_in)) - length(data_out)) > 4
|
||||
warning('Check signal length after pulse shaping');
|
||||
%disp('Check signal length after pulse shaping');
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user