Files
imdd_silas/projects/Messung_Zürich/minimal_matched.m
2026-01-30 12:16:27 +01:00

60 lines
1.5 KiB
Matlab

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