add few files from home pc
This commit is contained in:
60
projects/Messung_Zürich/minimal_matched.m
Normal file
60
projects/Messung_Zürich/minimal_matched.m
Normal file
@@ -0,0 +1,60 @@
|
||||
L = 4; % Oversampling factor
|
||||
fsym = 1e9/4;
|
||||
rollOff = 0.5; % Pulse shaping roll-off factor
|
||||
htx = rcosdesign(rollOff,16, L, 'sqrt');
|
||||
hrx = conj(fliplr(htx));
|
||||
|
||||
signal = zeros(1000,1);
|
||||
signal(500) = 1;
|
||||
Digi_sig = Informationsignal(signal,"fs",fsym);
|
||||
|
||||
% Digi_sig = Digi_sig.resample("fs_out",L*fsym);
|
||||
%
|
||||
% Digi_sig_tx = Digi_sig.filter(htx,1);
|
||||
% Digi_sig_rx = Digi_sig_tx.filter(hrx,1);
|
||||
%
|
||||
% figure;plot(Digi_sig_tx.signal);hold on;plot(Digi_sig_rx.signal),plot(Digi_sig.signal);
|
||||
%
|
||||
%
|
||||
%
|
||||
%
|
||||
pulsef = Pulseformer("alpha",1,"matched",0,"fdac",Digi_sig.fs*L,"fsym",fsym,"pulse","rrc","pulselength",16);
|
||||
Digi_sig = pulsef.process(Digi_sig);
|
||||
|
||||
pulsef = Pulseformer("alpha",1,"matched",1,"fdac",Digi_sig.fs,"fsym",fsym,"pulse","rrc","pulselength",16);
|
||||
Digi_sig_matched = pulsef.process(Digi_sig);
|
||||
|
||||
% Filter:
|
||||
htx = rcosdesign(rollOff,16, L, 'sqrt');
|
||||
% Note half of the target delay is used, because when combined
|
||||
% to the matched filter, the total delay will be achieved.
|
||||
hrx = conj(fliplr(htx));
|
||||
|
||||
figure
|
||||
plot(htx)
|
||||
title('Transmit Filter')
|
||||
xlabel('Index')
|
||||
ylabel('Amplitude')
|
||||
|
||||
figure
|
||||
plot(hrx)
|
||||
title('Rx Filter (Matched Filter)')
|
||||
xlabel('Index')
|
||||
ylabel('Amplitude')
|
||||
|
||||
p = conv(htx,hrx);
|
||||
|
||||
figure
|
||||
plot(p)
|
||||
title('Combined Tx-Rx = Raised Cosine')
|
||||
xlabel('Index')
|
||||
ylabel('Amplitude')
|
||||
|
||||
% And let's highlight the zero-crossings
|
||||
zeroCrossings = NaN*ones(size(p));
|
||||
zeroCrossings(1:L:end) = 0;
|
||||
zeroCrossings((rcDelay)*L + 1) = NaN; % Except for the central index
|
||||
hold on
|
||||
plot(zeroCrossings, 'o')
|
||||
legend('RC Pulse', 'Zero Crossings')
|
||||
hold off
|
||||
43
test/bitwise_demapping_pam6.m
Normal file
43
test/bitwise_demapping_pam6.m
Normal file
@@ -0,0 +1,43 @@
|
||||
|
||||
|
||||
%%%%% SETTINGS %%%%%%
|
||||
useprbs = 1;
|
||||
M = 8;
|
||||
randkey = 1;
|
||||
fsym = 112e9;
|
||||
viewresults = 0;
|
||||
|
||||
%%%%% Mapping %%%%%
|
||||
M = 6;
|
||||
data = 0:M-1;
|
||||
bitpersymbol = log2(M);
|
||||
|
||||
s = RandStream('twister','Seed',1);
|
||||
bitpattern = randi(s,[0 1], 2^18, 1);
|
||||
bitpattern = bitpattern(1:end-mod(length(bitpattern),5));
|
||||
|
||||
bits_tx = Informationsignal(bitpattern);
|
||||
|
||||
symbols = PAMmapper(M,0).map(bits);
|
||||
|
||||
pam6transitions = combvec(PAMmapper(M,0).levels,PAMmapper(M,0).levels)';
|
||||
|
||||
pam6bits = PAMmapper(6,0,"eth_style",0).demap(reshape(pam6transitions',[],1)./sqrt(10));
|
||||
symbols_rx = PAMmapper(M,0).map(pam6bits).*sqrt(10);
|
||||
|
||||
pam6bits = reshape(pam6bits',5,[])';
|
||||
|
||||
figure; hold on
|
||||
scatter(pam6transitions(:,1), pam6transitions(:,2), 'x', 'LineWidth', 1);
|
||||
n = size(pam6transitions,1);
|
||||
labels = cellstr(char(pam6bits + '0')); % -> N x 1 cell array of char rows
|
||||
text(pam6transitions(:,1), pam6transitions(:,2), labels, ...
|
||||
'HorizontalAlignment','left', 'VerticalAlignment','bottom');
|
||||
|
||||
|
||||
|
||||
bits_rx = PAMmapper(M,0).demap(symbols);
|
||||
|
||||
[~,error_num,ber,error_pos] = calc_ber(bits_tx.signal,bits_rx.signal,"skip_front",0,"skip_end",0,"returnErrorLocation",1);
|
||||
|
||||
PAMmapper(8,0).showBitMapping
|
||||
Reference in New Issue
Block a user