Merge commit '90e7c8299678a0c4890175dba6cb12d0c46453e6'

This commit is contained in:
Silas
2024-11-04 09:41:52 +01:00
14 changed files with 895 additions and 554 deletions

View File

@@ -344,14 +344,14 @@ classdef Signal
% spectrum_plot(obj.signal,options.fsamp,options.figurename,options.displayname);
N = 2^(nextpow2(length(obj.signal))-10);
N = 2^(nextpow2(length(obj.signal))-2);
if options.normalizeToNyquist==0
[p_lin,w] = pwelch(obj.signal,hanning(N),N/2,N,obj.fs,"centered","power","mean");
w=w.*1e-9;
else
[p_lin,w] = pwelch(obj.signal,hanning(N),N/2,N,"centered","power","mean");
p_lin = smooth(p_lin,0.05,'rloess');
% p_lin = smooth(p_lin,0.05,'rloess');
end
@@ -376,7 +376,7 @@ classdef Signal
if options.normalizeToNyquist==0
xlabel("Frequency in GHz");
%xlim([-obj.fs/2 obj.fs/2].*1e-9)
% xlim([-obj.fs/2 obj.fs/2].*1e-9)
edgetick = 2^(nextpow2(obj.fs*1e-9));
xticks([-edgetick:16:edgetick]);
xlim([100*round( min(w)/100,1)-10,100*round( max(w)/100,1)+10])

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 on;box on;title('Magnitude Freq. Response');
subplot(2,1,1);hold all;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 on; box on; title('Phase Freq. Response');
subplot(2,1,2); hold all; 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 on; box on; title('Inverse Magnitude Freq. Response');
subplot(2,1,1); hold all; 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,17 +236,19 @@ classdef ChannelFreqResp < handle
yline(3,'LineWidth',2,'LineStyle','--');
%4)
subplot(2,1,2); hold on; box on; title('Inverse Phase Freq. Response');
subplot(2,1,2); hold all; 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(30);hold on;box on;title('Magnitude Freq. Response');
% xlim([0 max(obj.faxis)*1e-9]);
% ylim([-20, 10]);
fax = obj.faxis - obj.f_ref/2;
Havg = Havg ./ max(abs(Havg));
plot(fax/1e9, 20*log10(abs(fftshift(Havg)))+7,'LineWidth',2);
figure(1234);hold all;box on;title('Magnitude Freq. Response');
%xlim([0.2 .5*max(obj.faxis)*1e-9]);
ylim([-40, 2]);
Havg_smooth = smooth(Havg,50);
symaxis = (obj.faxis-(obj.f_ref/2))/1e9;
Havg = fftshift(Havg);
Havg = smooth(Havg);
plot(symaxis, 20*log10(abs(Havg)),'LineWidth',0.5);
grid on;
@@ -362,7 +364,7 @@ classdef ChannelFreqResp < handle
end
% fprintf('Frequency response information successfully loaded from %s\n', fullFileName);
fprintf('Frequency response information successfully loaded from %s\n', fullFileName);
end
end

View File

@@ -125,6 +125,13 @@ classdef Duobinary
%make bipolar
data = (data-round(mean(data),1));
[unique_points, ~, idx] = unique(data);
counts = accumarray(idx, 1);
total_samples = numel(data);
probabilities = counts / total_samples;
mean_power = sum((unique_points .^ 2) .* probabilities);
scaling_factor = sqrt(mean_power);
if M == 4
data = data ./ sqrt(2.5); % 7-level constellation weighted with probability after DB code i.e. mean([-3 3 -2 -2 2 2 -1 -1 -1 1 1 1 0 0 0 0].^2) = 2.5 --> sqrt(2.5) == rms(constellation)
elseif M == 6

View File

@@ -1,4 +1,4 @@
classdef EQ
classdef EQ %< handle
%EQ Summary of this class goes here
% Detailed explanation goes here

View File

@@ -129,7 +129,7 @@ classdef DataStorage < handle
tmp = obj.sto.(storageVarName){lin_idx(i)};
if ~isempty(tmp)
if isa(tmp,'Signal') || isa(tmp,'struct') || isa(tmp,'Exfo_laser')
if isa(tmp,'Signal') || isa(tmp,'struct') || isa(tmp,'Exfo_laser') || isa(tmp,'DC_supply')
if i == 1
value = {};
end