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 = 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 ----- firstLegend = true; % ---- PLOT ALL POINTS (Marker basierend auf Band) ---- for i = 1:sum(idxPam) % === 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, ... 'MarkerEdgeColor', col, ... 'MarkerFaceColor', col, ... 'DisplayName', sprintf('PAM-%d', M)); firstLegend = false; else h = scatter(x(i), y(i), ms, ... 'Marker', marker, ... 'MarkerEdgeColor', col, ... 'MarkerFaceColor', col, ... 'HandleVisibility','off'); end % ====== CUSTOM DATATIP CONTENT ====== dt = h.DataTipTemplate; dt.DataTipRows(1).Label = 'Baud rate'; dt.DataTipRows(2).Label = 'Net rate'; dt.DataTipRows(end+1) = dataTipTextRow('Band', b(i)); % Zeigt Band an dt.DataTipRows(end+1) = dataTipTextRow('Paper', n(i)); end % ---- Fit (PAM-specific) ---- 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'); end end 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); %% === EXPORT === outfile = 'C:\Users\Silas\Documents\latex\JLT_400G copy\media\matlab2tikz\highspeedresults.tikz'; matlab2tikz(outfile, ... 'width','\fwidth', ... 'height','\fheight', ... 'showInfo',false, ... 'extraAxisOptions',{ ... 'legend style={font=\footnotesize}', ... 'legend columns=1' ... });