Commit before first big baudrate sweep

This commit is contained in:
Silas Labor Zizou
2024-10-24 19:41:59 +02:00
parent cfd1bdb513
commit bafc7f12b7
11 changed files with 588 additions and 318 deletions

View File

@@ -202,19 +202,19 @@ classdef ChannelFreqResp < handle
function plot(obj)
figure(55);
clf;
%clf;
Havg = obj.H;
%1)
subplot(2,1,1);hold all;box on;title('Magnitude Freq. Response');
subplot(2,1,1);hold on;box on;title('Magnitude Freq. Response');
plot(obj.faxis/1e9, 20*log10(abs(obj.H_all)),'linewidth',0.1,'LineStyle','-','Color','#808080') ;
xlim([0.2 .5*max(obj.faxis)*1e-9]);
plot(obj.faxis/1e9, 20*log10(abs(Havg)),'LineWidth',2);
grid on;
%2)
subplot(2,1,2); hold all; box on; title('Phase Freq. Response');
subplot(2,1,2); hold on; box on; title('Phase Freq. Response');
plot(obj.faxis/1e9, angle(obj.H_all),'linewidth',0.1,'LineStyle','-','Color','#808080') ;
plot(obj.faxis/1e9, unwrap(angle(Havg)),'LineWidth',2) ;
xlim([0.2 .5*max(obj.faxis)*1e-9]);
@@ -228,7 +228,7 @@ classdef ChannelFreqResp < handle
Havg = Havg./mean(Havg(2:10));
%3)
subplot(2,1,1); hold all; box on; title('Inverse Magnitude Freq. Response');
subplot(2,1,1); hold on; box on; title('Inverse Magnitude Freq. Response');
plot(obj.faxis/1e9, 20*log10(abs(1./Havg)),"LineWidth",2,"Color",[0.3467 0.5360 0.6907]) ;
xlim([0.2 .5*max(obj.faxis)*1e-9]); grid on;
ylim([-1 15]);
@@ -236,12 +236,12 @@ classdef ChannelFreqResp < handle
yline(3,'LineWidth',2,'LineStyle','--');
%4)
subplot(2,1,2); hold all; box on; title('Inverse Phase Freq. Response');
subplot(2,1,2); hold on; box on; title('Inverse Phase Freq. Response');
plot(obj.faxis/1e9, unwrap(angle(1./Havg)),"LineWidth",2,"Color",[0.3467 0.5360 0.6907]) ;
xlim([0.2 .5*max(obj.faxis)*1e-9]); grid on;
%%% plot for publication
figure(98989);hold all;box on;title('Magnitude Freq. Response');
figure(98989);hold on;box on;title('Magnitude Freq. Response');
xlim([0.2 .5*max(obj.faxis)*1e-9]);
ylim([-20, 2]);
plot(obj.faxis/1e9, 20*log10(abs(Havg)),'LineWidth',2);

View File

@@ -77,9 +77,42 @@ classdef PAMsource
bitpattern=[];
if obj.useprbs
for i = 1:log2(obj.M)
[bitpattern(:,i),seed] = prbs(O,N,seed);
% for i = 1:log2(obj.M)
% [bitpattern(:,i),seed] = prbs(O,N,seed);
% end
%%%%% MOVE-IT PRMS %%%%
state = struct();
para = struct();
if obj.M == 6
para.bl = 2^(obj.order-2);
para.dimension = 5;
else
para.bl = 2^(obj.order-1);
para.dimension = log2(obj.M); %2.5bits/sym -> 2 bit/sym
end
para.rand = 0;
para.order = floor(obj.order / log2(obj.M));
para.skip =0;
para.bruijn = 0;
para.reset_prms = 0;
para.method = 1;
data_in = [];
global loop;
loop = 0;
[data_out,state_] = prms(data_in, state, para);
loop = 1;
[data_out,state_out] = prms(data_in, state_, para);
bitpattern = data_out';
%%%%% END MOVE-IT %%%%%%%
else
s = RandStream('twister','Seed',obj.randkey);
for i = 1:log2(obj.M)
@@ -88,7 +121,7 @@ classdef PAMsource
end
if obj.M == 6
bitpattern = reshape(bitpattern,[],1);
bitpattern = reshape(bitpattern',[],1);
bitpattern = bitpattern(1:end-mod(length(bitpattern),5));
end
@@ -108,7 +141,7 @@ classdef PAMsource
end
% figure(12);hold on;histogram(symbols.signal,'Normalization','probability');
if obj.mrds_code
symbols = MRDS_coding("blocklength",obj.mrds_blocklength).encode(symbols);
end
@@ -128,7 +161,7 @@ classdef PAMsource
%%%%% Re-sample to f DAC %%%%%%
digi_sig = digi_sig.resample("fs_in",digi_sig.fs,"fs_out",obj.fs_out,"n",10,"beta",5);
% digi_sig.spectrum("fignum",111,"displayname","after pulseforming");
% digi_sig.spectrum("fignum",111,"displayname","after pulseforming");
%%%%% Hard clip digital signal to PAM range before DAC %%%%%%
if obj.applyclipping