dsp_options.database_type = "mysql"; dsp_options.dataBase = "labor"; dsp_options.server = "192.168.178.192"; dsp_options.port = 3306; dsp_options.user = "silas"; dsp_options.password = "silas"; db = DBHandler("dataBase", dsp_options.dataBase, "type", dsp_options.database_type, ... "server", dsp_options.server, "port", dsp_options.port, ... "user", dsp_options.user, "password", dsp_options.password); fp = QueryFilter(); % fp.where('Runs', 'symbolrate','EQUALS', 112e9); [dataTable,~] = db.queryDB(fp, db.getTableFieldNames('Runs')); %% TOTAL RUNS totalRuns = height(dataTable); %% Difference between "opti" and not opti (before and after run_id = 2661) fp = QueryFilter(); fp.where('Runs','run_id','LESS_THAN',3153); fp.where('Runs', 'db_mode','EQUALS', '"no_db"'); % fp.where('Runs', 'interference_path_length','EQUALS', 300); [dataTable_1,~] = db.queryDB(fp, db.getTableFieldNames('Runs')); fp = QueryFilter(); fp.where('Runs','run_id','GREATER_EQUAL',3153); % fp.where('Runs', 'interference_path_length','EQUALS', 300); [dataTable_2,~] = db.queryDB(fp, db.getTableFieldNames('Runs')); %% prepare x/y and plotting without forcing datetime priority for x % simplified: assume columns exist and no datetime special cases xCol = 'symbolrate'; yCol = 'v_awg'; % get x and y (fallback to NaN vectors of appropriate length) if ismember(xCol, dataTable_1.Properties.VariableNames) x1 = dataTable_1.(xCol); else x1 = NaN(height(dataTable_1),1); end if ismember(xCol, dataTable_2.Properties.VariableNames) x2 = dataTable_2.(xCol); else x2 = NaN(height(dataTable_2),1); end if ismember(yCol, dataTable_1.Properties.VariableNames) y1 = dataTable_1.(yCol); else y1 = NaN(height(dataTable_1),1); end if ismember(yCol, dataTable_2.Properties.VariableNames) y2 = dataTable_2.(yCol); else y2 = NaN(height(dataTable_2),1); end % convert text to numeric where needed toNum = @(v) double(string(v)); if iscell(x1) || isstring(x1) || ischar(x1), x1 = toNum(x1); end if iscell(x2) || isstring(x2) || ischar(x2), x2 = toNum(x2); end if iscell(y1) || isstring(y1) || ischar(y1), y1 = toNum(y1); end if iscell(y2) || isstring(y2) || ischar(y2), y2 = toNum(y2); end % simple scatter plots side-by-side figure; subplot(1,2,1); scatter(x1, y1, 36, 'b', 'filled'); xlabel(xCol); ylabel(yCol); title('dataTable\_1'); grid on; subplot(1,2,2); scatter(x2, y2, 36, 'r', 'filled'); xlabel(xCol); ylabel(yCol); title('dataTable\_2'); grid on; linkaxes(findall(gcf,'Type','axes'),'y'); %% Count interference path lengths by PAM and symbolrate pamCol = 'pam_level'; iplCol = 'interference_path_length'; rateCol = 'symbolrate'; pamLevels = [2, 4, 6, 8]; % Current analysis uses only the post-opti/post-threshold runs. % Use [dataTable_1; dataTable_2] here if the pre-threshold runs should be included. allData = dataTable_2; requiredCols = {pamCol, iplCol, rateCol}; missingCols = setdiff(requiredCols, allData.Properties.VariableNames); if ~isempty(missingCols) error('Missing required column(s): %s', strjoin(missingCols, ', ')); end pam = double(string(allData.(pamCol))); ipl = double(string(allData.(iplCol))); symbolrate = double(string(allData.(rateCol))); validRows = ~isnan(pam) & ~isnan(ipl) & ~isnan(symbolrate); iplValues = unique(ipl(validRows)); symbolrateValues = unique(symbolrate(validRows)); if isempty(iplValues) || isempty(symbolrateValues) error('No valid rows found for PAM/interference_path_length/symbolrate plotting.'); end iplCategories = categorical(string(iplValues), string(iplValues), string(iplValues)); symbolrateLabels = compose('%.0f GBd', symbolrateValues*1e-9); figure('Units', 'normalized', 'Position', [0.05 0.1 0.9 0.7]); tiledlayout(1, 5, 'TileSpacing', 'compact', 'Padding', 'compact'); for k = 1:numel(pamLevels) ax = nexttile; pamMask = validRows & pam == pamLevels(k); counts = zeros(numel(iplValues), numel(symbolrateValues)); for rateIdx = 1:numel(symbolrateValues) for iplIdx = 1:numel(iplValues) counts(iplIdx, rateIdx) = sum(pamMask ... & ipl == iplValues(iplIdx) ... & symbolrate == symbolrateValues(rateIdx)); end end bar(ax, iplCategories, counts, 'stacked'); xlabel(ax, 'interference\_path\_length'); ylabel(ax, 'count'); title(ax, sprintf('PAM %d', pamLevels(k))); xtickangle(ax, 45); grid(ax, 'on'); end axAll = nexttile; countsAll = zeros(numel(iplValues), numel(symbolrateValues)); for rateIdx = 1:numel(symbolrateValues) for iplIdx = 1:numel(iplValues) countsAll(iplIdx, rateIdx) = sum(validRows ... & ipl == iplValues(iplIdx) ... & symbolrate == symbolrateValues(rateIdx)); end end bar(axAll, iplCategories, countsAll, 'stacked'); xlabel(axAll, 'interference\_path\_length'); ylabel(axAll, 'count'); title(axAll, 'All PAMs'); xtickangle(axAll, 45); grid(axAll, 'on'); lgd = legend(axAll, symbolrateLabels, 'Location', 'eastoutside'); title(lgd, 'symbolrate');