changes from zurich; my mac

This commit is contained in:
Silas
2025-02-20 05:31:05 +01:00
parent d099efea03
commit cf94b67828
13 changed files with 197 additions and 148 deletions

View File

@@ -355,14 +355,14 @@ classdef Signal
end
if isempty(options.fft_length)
options.fft_length = 2^(nextpow2(length(obj.signal))-7);
options.fft_length = 2^(nextpow2(length(obj.signal))-6);
end
if options.normalizeToNyquist == 0
[p_lin,w] = pwelch(obj.signal,hanning(options.fft_length),options.fft_length/2,options.fft_length,obj.fs,"centered","psd","mean");
[p_lin,w] = pwelch(obj.signal,hanning(options.fft_length),options.fft_length/2,options.fft_length,obj.fs,"centered","power","mean");
w = w.*1e-9;
else
[p_lin,w] = pwelch(obj.signal,hanning(options.fft_length),options.fft_length/2,options.fft_length,"centered","psd","mean");
[p_lin,w] = pwelch(obj.signal,hanning(options.fft_length),options.fft_length/2,options.fft_length,"centered","power","mean");
end
if options.normalizeTo0dB
@@ -411,8 +411,9 @@ classdef Signal
try
ylim([max(min(floor(min(p_dbm))-3, ax.YLim(1)),-40), min(max(ceil(max(p_dbm))+3, ax.YLim(2)),10)]);
catch
ylim([min(floor(min(p_dbm))-3, ax.YLim(1)), max(ceil(max(p_dbm))+3, ax.YLim(2))]);
ylim([floor(min(p_dbm))-3, ceil(max(p_dbm))+3]);
end
ylim([floor(min(p_dbm))-3, ceil(max(p_dbm))+3]);
yticks(-200:10:10);
grid on; grid minor;
legend
@@ -661,6 +662,7 @@ classdef Signal
obj Signal
options.reference Signal
options.fs_ref = 0;
options.debug_plots = 0;
end
%normalize the signal
@@ -680,6 +682,12 @@ classdef Signal
%estimate start pos of signal
maxpeaknum = floor(length(a)/length(b));
[pks,pkpos] = findpeaks(abs(co./max(co)),'MinPeakDistance',length(b)/2,'MinPeakHeight',0.2,'NPeaks',maxpeaknum,'SortStr','descend');
if options.debug_plots
figure()
findpeaks(abs(co./max(co)),'MinPeakDistance',length(b)/2,'MinPeakHeight',0.2,'NPeaks',maxpeaknum,'SortStr','descend')
end
shifts = lags(pkpos);
shifts = shifts(shifts>=0);
@@ -722,8 +730,7 @@ classdef Signal
end
%plot all synced signals and the ref signal
debug = 0;
if debug
if options.debug_plots
figure;hold on;
for i = 1:size(S,1)
plot(S{i}.normalize('mode','oneone').signal(1000:1100),'LineWidth',0.1,'Color',[0.2157 0.4941 0.7216]);
@@ -837,9 +844,9 @@ classdef Signal
mode = 1;
histpoints = 1024; %% verticale resolution
histpoints = 1024*2; %% verticale resolution
histpoints = floor(histpoints/2)*2+1; %% to have the eye digram centered around one point make the vertical resolution uneven
histpoints_horizontal = 512; %% horizontal resolution
histpoints_horizontal = 512*2; %% horizontal resolution
hist_data=zeros(histpoints,histpoints_horizontal ); %% initilize eye diagram
if isa(obj,'Opticalsignal')
@@ -850,7 +857,10 @@ classdef Signal
sig = obj.signal;
end
x = (sig); %% make input signal rea)l
startpos = floor(0.1*length(sig));
endpos = floor(0.9*length(sig));
endpos = min(endpos,startpos+200000);
x = sig(startpos:endpos); %% make input signal rea)l
x = resample(x,fsym*histpoints_horizontal/2,obj.fs); %% up sample to original fsym rate