From 11a9933dd23fbe2a6b4f35a95a9ee984e710cb02 Mon Sep 17 00:00:00 2001 From: Mikael Henriksson <mikael.henriksson@liu.se> Date: Wed, 13 Jan 2021 11:23:38 +0100 Subject: [PATCH] Updated csv_to_plot script. --- csv_to_plot.m | 47 ++++++++++++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/csv_to_plot.m b/csv_to_plot.m index 7c1f7fd..7a9dceb 100644 --- a/csv_to_plot.m +++ b/csv_to_plot.m @@ -1,28 +1,41 @@ +% +% Plot results from the +% % Read input data. -in_data = readtable('sweep_my_divider_1_to_10/result.csv'); +in_data = readtable('../sweep_pe_float_2021-01-11_13:17:06/result.csv'); -% Extract all design names. -design_names = string( table2array(unique(in_data(:,1), 'stable')) ); -design_n = length(design_names); +% Generic sweep? +generic_sweep = width(in_data) > 3; +% Extract design names. +if generic_sweep + designs = string( table2array(unique(in_data(:,1), 'stable')) ); + design_n = length(designs); +else + design_n = 1; +end + +% Generate figure plot. figure; for n = 1:design_n - design_name = design_names(n); - design = in_data(table2cell(in_data(:,1)) == design_name, :); - - freq_MHz = 1000./table2array(design(:,2)); - size_um2 = table2array(design(:,3)); - plot(freq_MHz, size_um2, 'LineWidth', 2); - hold on; + % Generic sweep + if generic_sweep + design_name = designs(n); + design = in_data(table2cell(in_data(:,1)) == design_name, :); + freq_MHz = 1000./table2array(design(:,2)); + size_um2 = table2array(design(:,3)); + plot(freq_MHz, size_um2, 'LineWidth', 2); + legend(designs); + hold on; + % Single sweep + else + freq_MHz = 1000./table2array(in_data(:,1)); + size_um2 = table2array(in_data(:,2)); + plot(freq_MHz, size_um2, 'LineWidth', 2); + end end xlabel('Frequency MHz'); ylabel('Area um^2'); grid on; -legend(design_names); - - -period = in_data(:,1); -area = in_data(:,2); -power = in_data(:,3); -- GitLab