Lab push
ChannelFreqResp optimized and compared to move-it minimal lab setup
This commit is contained in:
@@ -192,6 +192,19 @@ classdef Signal
|
||||
|
||||
end
|
||||
|
||||
%% Add signals from one signal to another, the first object will sustain
|
||||
function Diff = minus(X,y)
|
||||
|
||||
if isa(y,'Signal')
|
||||
Diff = X;
|
||||
Diff.signal = X.signal - y.signal;
|
||||
elseif isnumeric(y)
|
||||
Diff = X;
|
||||
Diff.signal = X.signal - y;
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function Product = times(X,y)
|
||||
|
||||
if isa(y,'Signal')
|
||||
@@ -282,9 +295,11 @@ classdef Signal
|
||||
xlim([-obj.fs/2 obj.fs/2].*1e-9)
|
||||
edgetick = 2^(nextpow2(obj.fs*1e-9));
|
||||
% xticks([-edgetick:16:edgetick]);
|
||||
xlim([-244, 244])
|
||||
ylim([-120,10]);
|
||||
xlim([100*round( min(w.*1e-9)/100,1)-10,100*round( max(w.*1e-9)/100,1)+10])
|
||||
ylim([100*round( min(p_dbm)/100,1)-3,100*round( max(p_dbm)/100,1)+3]);
|
||||
yticks([-200:10:10]);
|
||||
grid on
|
||||
grid minor
|
||||
legend
|
||||
|
||||
end
|
||||
@@ -437,10 +452,13 @@ classdef Signal
|
||||
end
|
||||
|
||||
%plot all synced signals and the ref signal
|
||||
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]);
|
||||
plot(b(1000:1100),'LineWidth',1);
|
||||
debug = 0;
|
||||
if debug
|
||||
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]);
|
||||
plot(b(1000:1100),'LineWidth',1);
|
||||
end
|
||||
end
|
||||
|
||||
%return the sinal with the highest correlation...
|
||||
@@ -602,7 +620,6 @@ classdef Signal
|
||||
% beautify
|
||||
colormap(cbrewer2("Blues",4096));
|
||||
|
||||
|
||||
if isa(obj,'Opticalsignal')
|
||||
title("Optical Eye")
|
||||
ylabel("Power in mW");
|
||||
@@ -652,41 +669,15 @@ classdef Signal
|
||||
|
||||
|
||||
|
||||
% Define properties
|
||||
boxPosition = [0.15 0.86 0.2 0.05]; % Position for the first box [x y width height]
|
||||
boxColor = [0.9 0.9 0.9]; % Light grey background color
|
||||
boxEdgeColor = 'k'; % Black edge color
|
||||
boxLineStyle = '--'; % Dashed line style
|
||||
boxFontWeight = 'bold'; % Bold font
|
||||
|
||||
% Create first annotation box for Power
|
||||
annotation('textbox', boxPosition, ...
|
||||
'String', ['Power: ',num2str(pwr_dbm),' dBm'], ...
|
||||
'BackgroundColor', boxColor, ...
|
||||
'EdgeColor', boxEdgeColor, ...
|
||||
'LineStyle', boxLineStyle, ...
|
||||
'FontWeight', boxFontWeight, ...
|
||||
'HorizontalAlignment', 'center');
|
||||
|
||||
% Adjust position for the second box (slightly to the right)
|
||||
boxPosition = [0.37 0.86 0.2 0.05]; % Adjusted position
|
||||
|
||||
% Create second annotation box for PAPR
|
||||
annotation('textbox', boxPosition, ...
|
||||
'String', ['PAPR(lin):',num2str(papr_),''], ...
|
||||
'BackgroundColor', boxColor, ...
|
||||
'EdgeColor', boxEdgeColor, ...
|
||||
'LineStyle', boxLineStyle, ...
|
||||
'FontWeight', boxFontWeight, ...
|
||||
'HorizontalAlignment', 'center');
|
||||
|
||||
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');
|
||||
|
||||
[pk,loc] = findpeaks(hist_interest_smoth,"MinPeakDistance",40,"NPeaks",M,"MinPeakHeight",30);
|
||||
[pk,loc] = findpeaks(hist_interest_smoth,"MinPeakDistance",10,"NPeaks",M,"MinPeakHeight",30,"MinPeakProminence",10);
|
||||
|
||||
scatter(posxall,loc,'red','Marker','x','LineWidth',2);
|
||||
|
||||
yline(loc,'Color','red','LineWidth',1,'LineStyle',':');
|
||||
|
||||
for i = 1:numel(loc)
|
||||
@@ -717,6 +708,37 @@ classdef Signal
|
||||
thirdboxstring = ['OMA outer:',num2str(er),' V'];
|
||||
end
|
||||
|
||||
plot_infos = 0;
|
||||
if plot_infos
|
||||
|
||||
% Define properties
|
||||
boxPosition = [0.15 0.86 0.2 0.05]; % Position for the first box [x y width height]
|
||||
boxColor = [0.9 0.9 0.9]; % Light grey background color
|
||||
boxEdgeColor = 'k'; % Black edge color
|
||||
boxLineStyle = '--'; % Dashed line style
|
||||
boxFontWeight = 'bold'; % Bold font
|
||||
|
||||
% Create first annotation box for Power
|
||||
annotation('textbox', boxPosition, ...
|
||||
'String', ['Power: ',num2str(pwr_dbm),' dBm'], ...
|
||||
'BackgroundColor', boxColor, ...
|
||||
'EdgeColor', boxEdgeColor, ...
|
||||
'LineStyle', boxLineStyle, ...
|
||||
'FontWeight', boxFontWeight, ...
|
||||
'HorizontalAlignment', 'center');
|
||||
|
||||
% Adjust position for the second box (slightly to the right)
|
||||
boxPosition = [0.37 0.86 0.2 0.05]; % Adjusted position
|
||||
|
||||
% Create second annotation box for PAPR
|
||||
annotation('textbox', boxPosition, ...
|
||||
'String', ['PAPR(lin):',num2str(papr_),''], ...
|
||||
'BackgroundColor', boxColor, ...
|
||||
'EdgeColor', boxEdgeColor, ...
|
||||
'LineStyle', boxLineStyle, ...
|
||||
'FontWeight', boxFontWeight, ...
|
||||
'HorizontalAlignment', 'center');
|
||||
|
||||
|
||||
|
||||
annotation('textbox', boxPosition, ...
|
||||
@@ -728,6 +750,8 @@ classdef Signal
|
||||
'HorizontalAlignment', 'center');
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
yticks(linspace(0,histpoints,16));
|
||||
y_tickstring = sprintfc('%.2f', y_tickstring);
|
||||
yticklabels(y_tickstring);
|
||||
|
||||
Reference in New Issue
Block a user