version where the signal is flipped and added together
This commit is contained in:
213
run_loop.m
213
run_loop.m
@@ -1,61 +1,196 @@
|
||||
|
||||
dc_mu = [0 0.001 0.1];
|
||||
sirloop = -25:1:0;
|
||||
lw_loop = [0e6:1e6:10e6];
|
||||
clear
|
||||
|
||||
ber = zeros(length(dc_mu),length(sirloop),length(lw_loop));
|
||||
ber_a1 = zeros(length(dc_mu),length(sirloop),length(lw_loop));
|
||||
sir_loop = [-22:1.5:-15];
|
||||
|
||||
iterations=size(ber);
|
||||
%dc_tap_loop = [0.001 0.005 0.01 0.05 0.1 0.25];
|
||||
bw_loop = [1:10];
|
||||
|
||||
parfor ix = 1:numel(ber)
|
||||
lw_loop = [0e6:0.2e6:1e6 2e6:2e6:10e6 20e6:20e6:100e6];
|
||||
|
||||
data = cell(length(sir_loop),length(bw_loop),length(lw_loop));
|
||||
|
||||
iterations=size(data);
|
||||
|
||||
for ix = 1:numel(data)
|
||||
|
||||
[u1,u2,u3] = ind2sub(iterations,ix);
|
||||
|
||||
BER = imddmodel(dc_mu(u1),sirloop(u2),lw_loop(u3));
|
||||
output = imddmodel(sir_loop(u1),bw_loop(u2),lw_loop(u3));
|
||||
|
||||
ber(ix) = BER.ber;
|
||||
ber_a1(ix) = BER.ber_a1;
|
||||
data{ix} = output;
|
||||
|
||||
% ber(ix) = BER.ber;
|
||||
% ber_a1(ix) = BER.ber_a1;
|
||||
|
||||
disp(ix)
|
||||
|
||||
end
|
||||
|
||||
%% Plot Winlen Contour
|
||||
hdfec = 3.8e-3.*ones(size(sir_loop));
|
||||
|
||||
hdfec = 3.8e-3.*ones(size(sirloop));
|
||||
for dc = 1:size(data,2)
|
||||
for lw = 1:size(data,3)
|
||||
for s = 1:size(data,1)
|
||||
ber_lvlp(s,dc,lw) = data{s,dc,lw}.ber_dcsm;
|
||||
% ber_dcsm(wl,lw,s) = data{wl,s,lw}.ber_dcsm;
|
||||
end
|
||||
|
||||
a_bm = InterX([sir_loop;squeeze(ber_lvlp(:,dc,lw))'],[sir_loop;hdfec]);
|
||||
% a_dcsm = InterX([sirloop;squeeze(ber_dcsm(wl,lw,:))'],[sirloop;hdfec]);
|
||||
try
|
||||
thres_a0(dc,lw) = -a_bm(1);
|
||||
%thres_a1(wl,lw) = -a_dcsm(1);
|
||||
catch
|
||||
thres_a0(dc,lw) = NaN;
|
||||
%thres_a1(wl,lw) = NaN;
|
||||
end
|
||||
|
||||
for dc = 1:size(ber,1)
|
||||
for lw = 1:size(ber,3)
|
||||
a = InterX([sirloop;ber(dc,:,lw)],[sirloop;hdfec]);
|
||||
thres(dc,lw) = -a(1);
|
||||
end
|
||||
end
|
||||
|
||||
contour(thres,'LineWidth',2);
|
||||
figure(1)
|
||||
contour(lw_loop,bw_loop,thres_a0,14:0.2:21,'LineWidth',1.5,'FaceAlpha',0.3,'ShowText','on',"LabelFormat","%0.1f dB");
|
||||
a = flip(cbrewer2('seq','Spectral',32));
|
||||
a = [a(1:12,:); a(22:end,:)];
|
||||
colormap(a);
|
||||
clim([16 21]);
|
||||
ylabel("Window Length");
|
||||
xlabel("Linewidth in MHz");
|
||||
yticks(bw_loop);
|
||||
yticklabels(bw_loop);
|
||||
set(gca,'yscale','log');
|
||||
set(gca,'xscale','log');
|
||||
grid minor
|
||||
|
||||
|
||||
|
||||
|
||||
%% Plot
|
||||
col = linspecer(8);
|
||||
figure(1)
|
||||
hold on
|
||||
m = ["x","o","pentagram","hexagram","*","+"];
|
||||
cnt = 1;
|
||||
for d = 1%:size(data,2)
|
||||
for dc = 1:size(data,1)
|
||||
for lw = 1:size(data,3)
|
||||
ber_bm(dc,d,lw) = (data{dc,d,lw}.ber_bm);
|
||||
ber_dcsm(dc,d,lw) = data{dc,d,lw}.ber_dcsm;
|
||||
ber_lvsm(dc,d,lw) = data{dc,d,lw}.ber_lvsm;
|
||||
ber_lvlp(dc,d,lw) = (data{dc,d,lw}.ber_lvlp);
|
||||
end
|
||||
end
|
||||
i = 1;
|
||||
comm_dn = [];% ['EQ DC Tap: ',num2str(dc_tap_loop(d)),' m'];
|
||||
title("Dependency on Laser Linewidth; B2B; Delay : 2*50m")
|
||||
plot(lw_loop*1e-6,mean(squeeze(ber_bm(1:end,d,:)),1),"LineWidth",1.2,"Marker",m(1),"MarkerSize",5,'Color',col(cnt,:),'DisplayName',[' ',comm_dn]);
|
||||
plot(lw_loop*1e-6,mean(squeeze(ber_dcsm(1:end,d,:)),1),"LineWidth",1,"Marker",m(1+4),"MarkerSize",5,'LineStyle','--','Color',col(cnt,:),'DisplayName',['DC smoothing ',comm_dn],'HandleVisibility','on');
|
||||
plot(lw_loop*1e-6,mean(squeeze(ber_lvsm(1:end,d,:)),1),"LineWidth",1.2,"Marker",m(1+1),"MarkerSize",5,'LineStyle',':','Color',col(cnt,:),'DisplayName',['Lvl Smoothing ',comm_dn],'HandleVisibility','on');
|
||||
plot(lw_loop*1e-6,mean(squeeze(ber_lvlp(1:end,d,:)),1),"LineWidth",1,"Marker",m(1+3),"MarkerSize",5,'LineStyle','-.','Color',col(cnt,:),'DisplayName',['Lvl Lowpass ',comm_dn],'HandleVisibility','on');
|
||||
set(gca,'yscale','log');
|
||||
set(gca,'xscale','log');
|
||||
%xticklabels([10 100 1000 10000]);
|
||||
grid minor
|
||||
yline(3.8e-3,'LineWidth',2,'LineStyle','--','HandleVisibility','off');
|
||||
ylim([1e-3 4e-2]);
|
||||
ylabel("BER");
|
||||
xlabel("Linewidth in MHz")
|
||||
legend
|
||||
cnt = cnt+1;
|
||||
end
|
||||
|
||||
|
||||
figure(1)
|
||||
contour(lw_loop,sir_loop,thres_a0,16:0.4:21,'LineWidth',2,'FaceAlpha',0.3,'ShowText','on',"LabelFormat","%0.1f dB");
|
||||
clim([16 21]);
|
||||
ylabel("Bandwidth in Multiples of Linewidth");
|
||||
xlabel("Linewidth in MHz");
|
||||
% set(gca,'yscale','log');
|
||||
grid minor
|
||||
title("MPI removal - Optimization of Lowpass Filter Bandwidth")
|
||||
|
||||
figure(2)
|
||||
contour(lw_loop,sir_loop([1:10,12:end]),thres_a0([1:10,12:end],:),16:0.3:21,'LineWidth',2,'FaceAlpha',0.3,'ShowText','on',"LabelFormat","%0.1f dB");
|
||||
clim([16 21]);
|
||||
ylabel("Window Length");
|
||||
xlabel("Linewidth in MHz");
|
||||
set(gca,'yscale','log');
|
||||
grid minor
|
||||
title("MPI removal - Optimization of Averaging Window Length")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
%% Plot DC Tap Contour
|
||||
hdfec = 3.8e-3.*ones(size(bw_loop));
|
||||
thres_a0 = zeros(size(ber,1),size(ber,3));
|
||||
thres_a1 = zeros(size(ber,1),size(ber,3));
|
||||
for dc = 1:size(ber,1)
|
||||
for lw = 1:size(ber,3)
|
||||
a_lvsm = InterX([bw_loop;ber(dc,:,lw)],[bw_loop;hdfec]);
|
||||
thres_a0(dc,lw) = -a_lvsm(1);
|
||||
|
||||
a1 = InterX([bw_loop;ber_a1(dc,:,lw)],[bw_loop;hdfec]);
|
||||
thres_a1(dc,lw) = -a1(1);
|
||||
end
|
||||
end
|
||||
|
||||
figure(1)
|
||||
subplot(2,1,1)
|
||||
contour(lw_loop,sir_loop,thres_a0,16:0.5:21,'LineWidth',3,'FaceAlpha',0.3,'ShowText','on',"LabelFormat","%0.1f dB");
|
||||
clim([16 21]);
|
||||
ylabel("DC Tap");
|
||||
xlabel("Linewidth in MHz");
|
||||
set(gca,'yscale','log');
|
||||
grid minor
|
||||
subplot(2,1,2)
|
||||
contour(lw_loop,sir_loop,thres_a1,16:0.5:21,'LineWidth',3,'FaceAlpha',0.3,'ShowText','on',"LabelFormat","%0.1f dB");
|
||||
clim([16 21]);
|
||||
ylabel("DC Tap");
|
||||
xlabel("Linewidth in MHz");
|
||||
set(gca,'yscale','log');
|
||||
grid minor
|
||||
|
||||
yticks(1:length(dc_mu))
|
||||
yticklabels(dc_mu);
|
||||
%% Plot Curves of required SIR to see the minimum a bit better
|
||||
col = flip(cbrewer2('seq','Spectral',16));
|
||||
col = col([1:4, 10:end],:);
|
||||
figure(2)
|
||||
hold on
|
||||
for lw = [size(ber,3):-2:2 2 1]
|
||||
plot(sir_loop,thres_a0(:,lw),'DisplayName',[' Linewidth: ',num2str(lw_loop(lw)*1e-6), ' MHz'],'Color',col(lw,:),'Marker','o','MarkerFaceColor',col(lw,:),'LineWidth',2);
|
||||
set(gca,'xscale','log');
|
||||
end
|
||||
xlabel("DC Tap Value");
|
||||
ylabel("Required SIR to rech FEC in dB");
|
||||
|
||||
xticks(1:length(lw_loop));
|
||||
xticklabels(lw_loop*1e-6);
|
||||
%%
|
||||
col = linspecer(7);
|
||||
figure(3)
|
||||
cnt=1;
|
||||
for lw = [1,2,11]
|
||||
|
||||
grid on
|
||||
for i = 1:length(sir_loop)-1
|
||||
|
||||
subplot(1,3,cnt)
|
||||
hold on
|
||||
plot(-1.*bw_loop,ber(i,:,lw),"LineWidth",2,"Marker","o","MarkerSize",5,'Color',col(i,:),'DisplayName',['DC tap ',num2str(sir_loop(i))]);
|
||||
plot(-1.*bw_loop,ber_a1(i,:,lw),"LineWidth",2,"Marker","x","MarkerSize",5,'LineStyle','--','Color',col(i,:),'DisplayName',['A1. DC tap ',num2str(sir_loop(i))]);
|
||||
yline(3.8e-3,'LineWidth',2,'LineStyle','--','HandleVisibility','off');
|
||||
set(gca,'yscale','log');
|
||||
grid minor
|
||||
|
||||
xlim([15,30]);
|
||||
ylim([1e-4,1e-2]);
|
||||
xlabel("SIR in dB");
|
||||
ylabel("BER");
|
||||
title(['BER for different SIR;',' Linewidth: ',num2str(lw_loop(lw)*1e-6), ' MHz'])
|
||||
text(25,4.2e-3,"FEC $3.8 e^{-3}$");
|
||||
end
|
||||
cnt = cnt+1;
|
||||
end
|
||||
legend
|
||||
|
||||
%
|
||||
% col = cbrewer2('Paired',12);
|
||||
% scatter(-1.*thres(1),thres(2),'MarkerEdgeColor',col(2*i,:),'LineWidth',6,'DisplayName',['DC tap ',num2str(dc_mu(i))]);
|
||||
%
|
||||
% figure(1)
|
||||
% hold on
|
||||
% for i = 1:length(dc_mu)
|
||||
% plot(-1.*sirloop,ber(i,:),"LineWidth",2,"Marker","o","MarkerSize",3,'Color',col(2*i,:),'DisplayName',['DC tap ',num2str(dc_mu(i))]);
|
||||
% plot(-1.*sirloop,ber_a1(i,:),"LineWidth",2,"Marker","o","MarkerSize",3,'Color',col(2*i-1,:),'DisplayName',['A1. Linewidth in MHz ',num2str(dc_mu(i)*1e-6)]);
|
||||
% end
|
||||
%
|
||||
% yline(3.8e-3,'LineWidth',2,'LineStyle','--','HandleVisibility','off');
|
||||
% set(gca,'yscale','log');
|
||||
% grid minor
|
||||
% legend
|
||||
% xlabel("SIR");
|
||||
% ylabel("BER");
|
||||
% title("BER for different SIR")
|
||||
Reference in New Issue
Block a user