New MPI mitigation schemes // Duobinary // Start of FTN schemes
This commit is contained in:
@@ -237,12 +237,16 @@ classdef Signal
|
||||
|
||||
arguments
|
||||
obj Signal
|
||||
options.fs_in double
|
||||
options.fs_in double = obj.fs
|
||||
options.fs_out double
|
||||
options.n double = 10;
|
||||
options.beta double = 5;
|
||||
end
|
||||
|
||||
if options.fs_in ~= obj.fs
|
||||
warning('The signals fs is different from the given fs_in while it should be the same.');
|
||||
end
|
||||
|
||||
obj.signal = resample(obj.signal,options.fs_out,options.fs_in,options.n,options.beta);
|
||||
|
||||
desc = ['resample signal from ', num2str(options.fs_in*1e-9), ' GHz to ', num2str(options.fs_out*1e-9), ' GHz' ];
|
||||
@@ -265,7 +269,7 @@ classdef Signal
|
||||
% spectrum_plot(obj.signal,options.fsamp,options.figurename,options.displayname);
|
||||
|
||||
N = 2^(nextpow2(length(obj.signal))-8);
|
||||
|
||||
|
||||
[p_lin,w] = pwelch(obj.signal,hanning(N),N/2,N,obj.fs,"centered","power","mean");
|
||||
p_dbm = 10*log10(p_lin)+30; %dB to dBm in case of "power"
|
||||
|
||||
@@ -279,7 +283,7 @@ classdef Signal
|
||||
edgetick = 2^(nextpow2(obj.fs*1e-9));
|
||||
% xticks([-edgetick:16:edgetick]);
|
||||
xlim([-244, 244])
|
||||
ylim([-120,-0]);
|
||||
ylim([-120,10]);
|
||||
yticks([-200:10:10]);
|
||||
legend
|
||||
|
||||
@@ -301,7 +305,7 @@ classdef Signal
|
||||
pow = pow / 50;
|
||||
end
|
||||
pow = 10*log10(pow)+30; %dbm
|
||||
|
||||
|
||||
case power_notation.mW
|
||||
pow = pow .* 1e3; %mW
|
||||
|
||||
@@ -378,14 +382,23 @@ classdef Signal
|
||||
end
|
||||
|
||||
%%
|
||||
function [obj,delay_n] = delay(obj,options)
|
||||
function [obj] = delay(obj,delay,options)
|
||||
|
||||
arguments
|
||||
obj Signal
|
||||
options.delay_samples = 0
|
||||
delay double = 0
|
||||
options.mode delay_mode = delay_mode.samples
|
||||
end
|
||||
|
||||
obj.signal=delayseq(obj.signal,options.delay_samples);
|
||||
if options.mode == delay_mode.samples
|
||||
|
||||
obj.signal=delayseq(obj.signal,delay);
|
||||
|
||||
elseif options.mode == delay_mode.time
|
||||
|
||||
obj.signal=delayseq(obj.signal,delay,obj.fs);
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -415,7 +428,7 @@ classdef Signal
|
||||
end
|
||||
|
||||
% delay by lagging samples
|
||||
obj = obj.delay("delay_samples",-D);
|
||||
obj = obj.delay(-D,'mode','samples');
|
||||
|
||||
cuts = obj.length-(options.reference.length*q);
|
||||
|
||||
@@ -491,7 +504,7 @@ classdef Signal
|
||||
ppeak(i) = maxA - (difference/histpoints*loc(i));
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
if isa(obj,'Opticalsignal')
|
||||
er=10*log10(ppeak(1)/ppeak(end));
|
||||
@@ -633,31 +646,7 @@ classdef Signal
|
||||
hold on
|
||||
xline(posxall)
|
||||
|
||||
hist_interest = plot_data(:,posxall);
|
||||
hist_interest_smoth = smooth(hist_interest,20);
|
||||
a = scatter(hist_interest_smoth+posxall,1:length(hist_interest_smoth),4,'.','MarkerEdgeColor','red');
|
||||
|
||||
[pk,loc] = findpeaks(hist_interest_smoth,"MinPeakDistance",40,"NPeaks",M,"MinPeakHeight",30);
|
||||
scatter(posxall,loc,'red','Marker','x','LineWidth',2);
|
||||
yline(loc,'Color','red','LineWidth',1,'LineStyle',':');
|
||||
|
||||
for i = 1:numel(loc)
|
||||
ppeak(i) = maxA - (difference/histpoints*loc(i));
|
||||
end
|
||||
|
||||
oma = false;
|
||||
if isa(obj,'Opticalsignal')
|
||||
er=10*log10(ppeak(1)/ppeak(end));
|
||||
elseif isa(obj,'Electricalsignal')
|
||||
if mean([ppeak(1),ppeak(end)]) < 1e-2
|
||||
oma = true;
|
||||
er=max(ppeak)-min(ppeak);
|
||||
else
|
||||
er=10*log10(ppeak(1)/ppeak(end));
|
||||
end
|
||||
else
|
||||
er=10*log10(ppeak(1)/ppeak(end));
|
||||
end
|
||||
|
||||
% Define properties
|
||||
boxPosition = [0.15 0.86 0.2 0.05]; % Position for the first box [x y width height]
|
||||
@@ -687,24 +676,53 @@ classdef Signal
|
||||
'FontWeight', boxFontWeight, ...
|
||||
'HorizontalAlignment', 'center');
|
||||
|
||||
% Adjust position for the third box (slightly to the right)
|
||||
boxPosition = [0.59 0.86 0.2 0.05]; % Adjusted position
|
||||
try
|
||||
hist_interest = plot_data(:,posxall);
|
||||
hist_interest_smoth = smooth(hist_interest,20);
|
||||
a = scatter(hist_interest_smoth+posxall,1:length(hist_interest_smoth),4,'.','MarkerEdgeColor','red');
|
||||
|
||||
% Create third annotation box for Vmax
|
||||
if ~oma
|
||||
thirdboxstring = ['ER (db):',num2str(er),' dB'];
|
||||
else
|
||||
thirdboxstring = ['OMA outer:',num2str(er),' V'];
|
||||
end
|
||||
[pk,loc] = findpeaks(hist_interest_smoth,"MinPeakDistance",40,"NPeaks",M,"MinPeakHeight",30);
|
||||
scatter(posxall,loc,'red','Marker','x','LineWidth',2);
|
||||
yline(loc,'Color','red','LineWidth',1,'LineStyle',':');
|
||||
|
||||
annotation('textbox', boxPosition, ...
|
||||
'String',thirdboxstring , ...
|
||||
'BackgroundColor', boxColor, ...
|
||||
'EdgeColor', boxEdgeColor, ...
|
||||
'LineStyle', boxLineStyle, ...
|
||||
'FontWeight', boxFontWeight, ...
|
||||
'HorizontalAlignment', 'center');
|
||||
for i = 1:numel(loc)
|
||||
ppeak(i) = maxA - (difference/histpoints*loc(i));
|
||||
end
|
||||
|
||||
oma = false;
|
||||
if isa(obj,'Opticalsignal')
|
||||
er=10*log10(ppeak(1)/ppeak(end));
|
||||
elseif isa(obj,'Electricalsignal')
|
||||
if mean([ppeak(1),ppeak(end)]) < 1e-2
|
||||
oma = true;
|
||||
er=max(ppeak)-min(ppeak);
|
||||
else
|
||||
er=10*log10(ppeak(1)/ppeak(end));
|
||||
end
|
||||
else
|
||||
er=10*log10(ppeak(1)/ppeak(end));
|
||||
end
|
||||
|
||||
% Adjust position for the third box (slightly to the right)
|
||||
boxPosition = [0.59 0.86 0.2 0.05]; % Adjusted position
|
||||
|
||||
% Create third annotation box for Vmax
|
||||
if ~oma
|
||||
thirdboxstring = ['ER (db):',num2str(er),' dB'];
|
||||
else
|
||||
thirdboxstring = ['OMA outer:',num2str(er),' V'];
|
||||
end
|
||||
|
||||
|
||||
|
||||
annotation('textbox', boxPosition, ...
|
||||
'String',thirdboxstring , ...
|
||||
'BackgroundColor', boxColor, ...
|
||||
'EdgeColor', boxEdgeColor, ...
|
||||
'LineStyle', boxLineStyle, ...
|
||||
'FontWeight', boxFontWeight, ...
|
||||
'HorizontalAlignment', 'center');
|
||||
end
|
||||
|
||||
yticks(linspace(0,histpoints,16));
|
||||
y_tickstring = sprintfc('%.2f', y_tickstring);
|
||||
|
||||
Reference in New Issue
Block a user