MPI Simulations and stuff
This commit is contained in:
66
projects/MPI_August/tx_model.m
Normal file
66
projects/MPI_August/tx_model.m
Normal file
@@ -0,0 +1,66 @@
|
||||
|
||||
function [el_sig,bits,symbol_seq] = tx_model(fsym,Pmap,Pform,Awg,options)
|
||||
|
||||
arguments
|
||||
fsym
|
||||
Pmap
|
||||
Pform
|
||||
Awg
|
||||
options.clipfactor
|
||||
end
|
||||
|
||||
%%%%% Local Parameter %%%%%%%%
|
||||
|
||||
|
||||
%%%%% PRBS Generation in correct shape for Modulation Format %%%%%%
|
||||
O = 17; %order of prbs
|
||||
N = 2^(O-1); %length of prbs
|
||||
[~,seed] = prbs(O,1); %initialize first seed of prbs
|
||||
bitpattern=[];
|
||||
for i = 1:log2(Pmap.M)
|
||||
[bitpattern(:,i),seed] = prbs(O,N,seed);
|
||||
end
|
||||
|
||||
if Pmap.M == 6
|
||||
bitpattern = reshape(bitpattern,[],1);
|
||||
bitpattern = bitpattern(1:end-mod(length(bitpattern),5));
|
||||
end
|
||||
|
||||
bits = Informationsignal(bitpattern);
|
||||
|
||||
%%%%% Map to PAM %%%%%%
|
||||
symbol_seq = Pmap.map(bits);
|
||||
symbol_seq.fs = fsym;
|
||||
|
||||
|
||||
|
||||
%%%%% Pulseforming %%%%%%
|
||||
if 1
|
||||
X = Pform.process(symbol_seq);
|
||||
else
|
||||
X = symbol_seq;
|
||||
end
|
||||
|
||||
%%%%% Resample to f DAC %%%%%%
|
||||
X = X.resample("fs_in",X.fs,"fs_out",Awg.fdac,"n",10,"beta",5);
|
||||
|
||||
%%%%% Clip to PAM range %%%%%%
|
||||
if 1
|
||||
min_ = min(symbol_seq.signal) * options.clipfactor ;
|
||||
max_ = max(symbol_seq.signal) * options.clipfactor ;
|
||||
X.signal = clip(X.signal,min_,max_);
|
||||
end
|
||||
|
||||
%%%%%Info about AWG input %%%%%%
|
||||
pwr_ = X.power; % in dbm into 50 ohm
|
||||
papr_ = papr(X.signal);
|
||||
vpk_ = max(abs(X.signal));
|
||||
vswing_ = max(X.signal)-min(X.signal);
|
||||
awg_string = ['Digital AWG Input: Pout: ',num2str(round(pwr_,2)),' dBm; PAPR: ',num2str(round(papr_,2)),'; Vpk: ',num2str(round(vpk_,2)),'; Vswing: ',num2str(round(vswing_,2)),''];
|
||||
% isp(awg_string);
|
||||
|
||||
%%%%% AWG %%%%%%
|
||||
el_sig = Awg.process(X);
|
||||
el_sig= el_sig.*0.7222;
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user