PR filter viz
Zürich data Refactoring/ Organization
This commit is contained in:
100
Theory/Signal_Processing/partial_response_filter.m
Normal file
100
Theory/Signal_Processing/partial_response_filter.m
Normal file
@@ -0,0 +1,100 @@
|
||||
|
||||
% DUOBINARY CLASSES
|
||||
% Define the filter taps
|
||||
h_ = {1,[1 1],[1 2 1],[1 3 3 1]};
|
||||
desc = {'$1$','$(1+D)$','$(1+D)^2$','$(1+D)^3$'};
|
||||
|
||||
for i = 1:length(h_)
|
||||
h = h_{i};
|
||||
|
||||
[H, w] = freqz(h, 1, 1024, 1);
|
||||
|
||||
figure(1);
|
||||
hold on
|
||||
plot(w, 10*log10(abs(H)), 'LineWidth', 1, 'DisplayName',desc{i}); %todo
|
||||
xlabel('Normalized Frequency');
|
||||
ylabel('Amplitude in dB');
|
||||
grid on;
|
||||
ylim([-20,10]);
|
||||
|
||||
end
|
||||
|
||||
legend
|
||||
beautifyBERplot("logscale",false,"setmarkers",false);
|
||||
% mat2tikz_improved("C:/Users/Silas/Documents/6971e0b65b380ca6d71c837f/03_DSP_Techniques/tikz/duobinary_response.tikz")
|
||||
|
||||
%%
|
||||
|
||||
% 1+ alpha D
|
||||
% Define the filter taps
|
||||
h_ = {[1, 0],[1 0.2],[1 0.4],[1 0.6],[1 0.8],[1 1]};
|
||||
|
||||
for i = 1:length(h_)
|
||||
h = h_{i};
|
||||
|
||||
[H, w] = freqz(h, 1, 1024, 1);
|
||||
|
||||
figure(2);
|
||||
hold on
|
||||
plot(w, 10*log10(abs(H)), 'LineWidth', 2,'DisplayName',sprintf('$\\alpha = %.1f$', h(end))); %todo
|
||||
xlabel('Normalized Frequency');
|
||||
ylabel('Amplitude in dB');
|
||||
grid on;
|
||||
ylim([-15,5])
|
||||
end
|
||||
legend
|
||||
beautifyBERplot("logscale",false,"setmarkers",false);
|
||||
% mat2tikz_improved("C:/Users/Silas/Documents/6971e0b65b380ca6d71c837f/03_DSP_Techniques/tikz/partial_response.tikz")
|
||||
|
||||
%%
|
||||
|
||||
useprbs = 0;
|
||||
M = 4;
|
||||
randkey = 2;
|
||||
fsym = 112e9;
|
||||
|
||||
%%%%% PRBS Generation in correct shape for Modulation Format %%%%%%
|
||||
O = 19; %order of prbs
|
||||
N = 2^(O-1); %length of prbs
|
||||
[~,seed] = prbs(O,1); %initialize first seed of prbs
|
||||
bitpattern=[];
|
||||
|
||||
if useprbs
|
||||
for i = 1:log2(M)
|
||||
[bitpattern(:,i),seed] = prbs(O,N,seed);
|
||||
end
|
||||
else
|
||||
s = RandStream('twister','Seed',randkey);
|
||||
for i = 1:log2(M)
|
||||
bitpattern(:,i) = randi(s,[0 1], N, 1);
|
||||
end
|
||||
end
|
||||
|
||||
if M == 6
|
||||
bitpattern = reshape(bitpattern,[],1);
|
||||
bitpattern = bitpattern(1:end-mod(length(bitpattern),5));
|
||||
end
|
||||
|
||||
Tx_bits = Informationsignal(bitpattern);
|
||||
|
||||
Digi_Mod = PAMmapper(M,0);
|
||||
Symbols_tx = Digi_Mod.map(Tx_bits);
|
||||
Symbols_tx.fs = fsym;
|
||||
|
||||
cnt = 1;
|
||||
|
||||
Symbols = Symbols_tx;
|
||||
|
||||
Symbols = Duobinary().precode(Symbols);
|
||||
Symbols = Duobinary().encode(Symbols);
|
||||
|
||||
figure()
|
||||
histogram()
|
||||
|
||||
% Symbols = Duobinary().decode(Symbols);
|
||||
|
||||
|
||||
% coeff = [1,0.5];
|
||||
%
|
||||
% Symbols.signal = filter(coeff, 1, Symbols.signal);
|
||||
% Symbols.spectrum("fignum",2,"displayname",['coeff:',num2str(coeff)],"normalizeTo0dB",1);
|
||||
Reference in New Issue
Block a user