Merge branch 'main' of cau-git.rz.uni-kiel.de:nt/mitarbeiter/silas/imdd_simulation
This commit is contained in:
@@ -698,18 +698,19 @@ classdef Signal
|
||||
if numel(shifts) > 0
|
||||
|
||||
%Cut occurences of ref signal from signal (only positive shifts)
|
||||
if all(sign(co(pkpos)))
|
||||
isFlipped = 1;
|
||||
end
|
||||
|
||||
for c = shifts(shifts>=0)
|
||||
sig = obj.delay(-c,'mode','samples');
|
||||
sig.signal = sig.signal(1:length(b));
|
||||
sig.signal = sig.signal(1:length(b)).*-isFlipped;
|
||||
S{end+1,1} = sig;
|
||||
end
|
||||
|
||||
%
|
||||
|
||||
if all(sign(co(pkpos)))
|
||||
isFlipped = 1;
|
||||
end
|
||||
|
||||
|
||||
%return/keep the sinal with the highest correlation (only within positive shifts)
|
||||
[~,idx]=max(pks(shifts>=0));
|
||||
|
||||
@@ -71,20 +71,17 @@ classdef PAMsource
|
||||
function [digi_sig,symbols,bits] = process(obj)
|
||||
|
||||
%%%%% PRBS Generation in correct shape for Modulation Format %%%%%%
|
||||
O = obj.order; %order of prbs
|
||||
N = 2^(O-1); %length of prbs
|
||||
[~,seed] = prbs(O,1); %initialize first seed of prbs
|
||||
bitpattern=[];
|
||||
|
||||
if obj.useprbs
|
||||
% for i = 1:log2(obj.M)
|
||||
% [bitpattern(:,i),seed] = prbs(O,N,seed);
|
||||
% end
|
||||
% O = obj.order; %order of prbs
|
||||
% N = 2^(O-1); %length of prbs
|
||||
% [~,seed] = prbs(O,1); %initialize first seed of prbs
|
||||
% % for i = 1:log2(obj.M)
|
||||
% % [bitpattern(:,i),seed] = prbs(O,N,seed);
|
||||
% % end
|
||||
|
||||
%%%%% MOVE-IT PRMS %%%%
|
||||
|
||||
|
||||
|
||||
state = struct();
|
||||
|
||||
para = struct();
|
||||
@@ -120,6 +117,7 @@ classdef PAMsource
|
||||
else
|
||||
s = RandStream('twister','Seed',obj.randkey);
|
||||
for i = 1:log2(obj.M)
|
||||
N = 2^(obj.order-1); %length of prbs
|
||||
bitpattern(:,i) = randi(s,[0 1], N, 1);
|
||||
end
|
||||
end
|
||||
@@ -155,24 +153,46 @@ classdef PAMsource
|
||||
sym_max = max(symbols.signal);
|
||||
end
|
||||
|
||||
% symbols.spectrum("fignum",111,"displayname","1) RAW SIGNAL");
|
||||
|
||||
pulsf = Moveit_wrapper('pulsef');
|
||||
pulsf.para.alpharacos = obj.pulseformer.alpha;
|
||||
pulsf.para.f_sym = obj.fsym;
|
||||
pulsf.para.fs = obj.fsym;
|
||||
pulsf.para.pulse = 'racos';
|
||||
|
||||
pulsf.process(symbols);
|
||||
|
||||
%%%%% Pulse-forming %%%%%%
|
||||
if obj.applypulseform
|
||||
%%% MY CODE
|
||||
digi_sig = obj.pulseformer.process(symbols);
|
||||
|
||||
%%% MOVEIT WRAPPER BETA
|
||||
% symbols.spectrum("fignum",111,"displayname","1) RAW SIGNAL");
|
||||
%
|
||||
% pulsf = Moveit_wrapper('pulsef');
|
||||
% pulsf.para.alpharacos = obj.pulseformer.alpha;
|
||||
% pulsf.para.f_sym = obj.fsym;
|
||||
% pulsf.para.fs = obj.fsym;
|
||||
% pulsf.para.pulse = 2;
|
||||
%
|
||||
% digi_sig = pulsf.process(symbols);
|
||||
|
||||
% Design raised cosine filter with given order in symbols
|
||||
% digi_sig = symbols;
|
||||
% sps = 4;
|
||||
% nsym = 128;
|
||||
% rctFilt3 = comm.RaisedCosineTransmitFilter(...
|
||||
% Shape='Square root', ...
|
||||
% RolloffFactor=1, ...
|
||||
% FilterSpanInSymbols=nsym, ...
|
||||
% OutputSamplesPerSymbol=sps);
|
||||
%
|
||||
% digi_sig.signal = rctFilt3([symbols.signal; zeros(nsym/2,1)]);
|
||||
% % Correct for propagation delay by removing filter transients
|
||||
% fltDelay = nsym / (2*obj.fsym);
|
||||
% digi_sig.signal = digi_sig.signal(fltDelay*sps*obj.fsym+1:end);
|
||||
%
|
||||
% digi_sig.fs = sps .* symbols.fs;
|
||||
|
||||
|
||||
else
|
||||
digi_sig = symbols;
|
||||
end
|
||||
|
||||
% digi_sig.spectrum("fignum",112,"displayname","2) after pulseforming");
|
||||
|
||||
%%%%% Re-sample to f DAC %%%%%%
|
||||
n = 10;
|
||||
|
||||
@@ -50,7 +50,7 @@ classdef Pulseformer
|
||||
signalclass_in = signalclass_in.logbookentry(lbdesc);
|
||||
|
||||
% write fs to signal
|
||||
signalclass_in.fs = obj.fdac;
|
||||
signalclass_in.fs = obj.fdac .* (obj.fdac./obj.fsym);
|
||||
|
||||
% write to output
|
||||
signalclass_out = signalclass_in;
|
||||
@@ -98,14 +98,14 @@ classdef Pulseformer
|
||||
%Bau das Filter (hier rc)
|
||||
racos_len = obj.pulselength*2;
|
||||
h = rcosdesign(obj.alpha,racos_len,sps,filtertype);
|
||||
h = h./ max(h);
|
||||
% h = h./ max(h);
|
||||
|
||||
if obj.matched
|
||||
h = 1./h;
|
||||
h = conj(fliplr(h));
|
||||
end
|
||||
|
||||
manual_cyclic_convolution = 1;
|
||||
upfirdn_convolution = 0;
|
||||
manual_cyclic_convolution = 0;
|
||||
upfirdn_convolution = 1;
|
||||
|
||||
if manual_cyclic_convolution
|
||||
|
||||
@@ -131,14 +131,13 @@ classdef Pulseformer
|
||||
if upfirdn_convolution
|
||||
|
||||
%Apply Filter using Matlab build in fctn.
|
||||
h = rcosdesign(obj.alpha,racos_len,sps,"normal");
|
||||
h = h./ max(h);
|
||||
|
||||
data_out_ = upfirdn(data_in,h,up,dn);
|
||||
|
||||
%cut signal, which is longer due to fir filter
|
||||
st = round(up/dn*racos_len/2)+1; %we need to cut y_out
|
||||
st = round(up/dn*racos_len/2); %we need to cut y_out
|
||||
en = round(st + (length(data_in)*up/dn));
|
||||
data_out_ = data_out_(st:en);
|
||||
data_out = data_out_(st:en);
|
||||
|
||||
end
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ classdef Moveit_wrapper < handle
|
||||
previousLevel = currentLevel;
|
||||
|
||||
% Determine input type from obj.comment.type
|
||||
if
|
||||
if 1
|
||||
inputType = obj.comment.type.(fieldName);
|
||||
else
|
||||
inputType = 'number'; % Default type
|
||||
|
||||
Reference in New Issue
Block a user