diff --git a/projects/HighSpeedExperiment_2024/Auswertung_JLT/final/FIGURE_introduction.m b/projects/HighSpeedExperiment_2024/Auswertung_JLT/final/FIGURE_introduction.m index 2213c8a..f9af8de 100644 --- a/projects/HighSpeedExperiment_2024/Auswertung_JLT/final/FIGURE_introduction.m +++ b/projects/HighSpeedExperiment_2024/Auswertung_JLT/final/FIGURE_introduction.m @@ -1,33 +1,73 @@ +tablename = 'C:\Users\Silas\Documents\latex\JLT_400G_submission\HighSpeedExperiments_oneandonly_csv.csv'; +% Returns a Table +data = readtable(tablename,"Delimiter",';','DecimalSeparator',','); + + %% ============================================================ % PLOT % ============================================================ +%% 1. DATA EXTRACTION & SETUP +% Extract columns from the table +raw_M = data.M; +raw_baud = data.BaudRate; +raw_net = data.NetRate; +raw_names = string(data.ZoteroCode); +raw_band = string(data.Band); % Spalte 'Band' als String extrahieren + +% Filter: Keep only PAM 2, 4, 6, 8 and rows where Rates are not NaN +target_M = [2, 4, 6, 8]; +validIdx = ismember(raw_M, target_M) & ~isnan(raw_baud) & ~isnan(raw_net); + +% Apply filter to create the working variables +Mvals = raw_M(validIdx); +baud = raw_baud(validIdx); +netrate = raw_net(validIdx); +names = raw_names(validIdx); +bands = raw_band(validIdx); % Gefilterte Bands + +% Setup Lists for Formatting +pam_list = target_M; + +% Visual Settings +colors = lines(4); % 4 Farben für PAM-2,4,6,8 + +% 2. PLOT figure; hold on; -ms = 32; % scatter size -lw = 0.8; % line width - -for k = 1:4 % PAM-2/4/6/8 +ms = 40; % Marker size (etwas größer für bessere Sichtbarkeit) +lw = 1.5; % Line width für Fit +for k = 1:length(pam_list) % Loop durch PAM-Formate M = pam_list(k); + + % Logical mask for current PAM idxPam = (Mvals == M); - + % Extract for this PAM x = baud(idxPam); y = netrate(idxPam); n = names(idxPam); - + b = bands(idxPam); % Bands für diese PAM-Gruppe + % Get color for this PAM format col = colors(k,:); - - % ----- LEGEND FLAG (only add one entry per PAM) ----- + + % ----- LEGEND FLAG ----- firstLegend = true; - - % ---- PLOT ALL POINTS (marker based on publication) ---- + + % ---- PLOT ALL POINTS (Marker basierend auf Band) ---- for i = 1:sum(idxPam) - - % marker selection by publication - pubIdx = find(pub_list == n(i), 1); - marker = markerlist{mod(pubIdx-1, nMarkers) + 1}; - + + % === MARKER LOGIC === + currentBand = b(i); + if strcmpi(currentBand, 'O') + marker = 'o'; % Kreis für O-Band + elseif strcmpi(currentBand, 'C') + marker = 'd'; % Diamond für C-Band + else + marker = 's'; % Fallback (Quadrat), falls andere Bands auftauchen + end + + % Plotting if firstLegend h = scatter(x(i), y(i), ms, ... 'Marker', marker, ... @@ -42,36 +82,32 @@ for k = 1:4 % PAM-2/4/6/8 'MarkerFaceColor', col, ... 'HandleVisibility','off'); end - + % ====== CUSTOM DATATIP CONTENT ====== dt = h.DataTipTemplate; dt.DataTipRows(1).Label = 'Baud rate'; dt.DataTipRows(2).Label = 'Net rate'; - - % Add publication name - dt.DataTipRows(end+1) = dataTipTextRow('Publication', n(i)); - - + dt.DataTipRows(end+1) = dataTipTextRow('Band', b(i)); % Zeigt Band an + dt.DataTipRows(end+1) = dataTipTextRow('Paper', n(i)); end - + % ---- Fit (PAM-specific) ---- - valid = ~isnan(x) & ~isnan(y); - if sum(valid) >= 3 - p = polyfit(x(valid), y(valid), 2); - xfit = linspace(min(x(valid)), max(x(valid)), 200); - yfit = polyval(p, xfit); - + if length(x) >= 3 + [p, S, mu] = polyfit(x, y, 2); + xfit = linspace(min(x), max(x), 200); + yfit = polyval(p, xfit, S, mu); + plot(xfit, yfit, ':', ... 'LineWidth', lw, ... 'Color', col, ... - 'HandleVisibility', 'off'); % do NOT add to legend + 'HandleVisibility', 'off'); end end -grid on; +grid on; box on; xlabel('Baud rate [GBd]'); ylabel('Net rate [Gb/s]'); - +title('Transmission Records (Circle=O, Diamond=C)'); legend('Location','northwest'); set(gca,'FontSize',11);