From 040abec33c4b81db7a1fa612d7e2280d69cf017a Mon Sep 17 00:00:00 2001 From: craig-warren Date: Tue, 15 Aug 2017 11:06:59 +0100 Subject: [PATCH] Updated loading and plotting of time array to match Python plotting tools, i.e. in seconds rather than nano-seconds. --- tools/MATLAB scripts/plot_Ascan.m | 14 +++++++------- tools/MATLAB scripts/plot_Bscan.m | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/MATLAB scripts/plot_Ascan.m b/tools/MATLAB scripts/plot_Ascan.m index 24ebdb8e..efde7e85 100644 --- a/tools/MATLAB scripts/plot_Ascan.m +++ b/tools/MATLAB scripts/plot_Ascan.m @@ -20,7 +20,7 @@ if filename ~= 0 header.nrx = h5readatt(fullfilename, '/', 'nrx'); % Time vector for plotting - time = linspace(0, (header.iterations)*(header.dt)*1E9, header.iterations); + time = linspace(0, (header.iterations)*(header.dt), header.iterations)'; % Initialise structure for field arrays fields.ex = zeros(header.iterations, header.nrx); @@ -46,12 +46,12 @@ if filename ~= 0 fields.hz(:,n) = h5read(fullfilename, strcat(path, 'Hz')); fh1=figure('Name', strcat('rx', num2str(n))); - ax(1) = subplot(3,2,1); plot(time, fields.ex(:,n), 'r', 'LineWidth', 2), grid on, xlabel('Time [ns]'), ylabel('Field strength [V/m]'), title('E_x') - ax(2) = subplot(3,2,3); plot(time, fields.ey(:,n), 'r', 'LineWidth', 2), grid on, xlabel('Time [ns]'), ylabel('Field strength [V/m]'), title('E_y') - ax(3) = subplot(3,2,5); plot(time, fields.ez(:,n), 'r', 'LineWidth', 2), grid on, xlabel('Time [ns]'), ylabel('Field strength [V/m]'), title('E_z') - ax(4) = subplot(3,2,2); plot(time, fields.hx(:,n), 'b', 'LineWidth', 2), grid on, xlabel('Time [ns]'), ylabel('Field strength [A/m]'), title('H_x') - ax(5) = subplot(3,2,4); plot(time, fields.hy(:,n), 'b', 'LineWidth', 2), grid on, xlabel('Time [ns]'), ylabel('Field strength [A/m]'), title('H_y') - ax(6) = subplot(3,2,6); plot(time, fields.hz(:,n), 'b', 'LineWidth', 2), grid on, xlabel('Time [ns]'), ylabel('Field strength [A/m]'), title('H_z') + ax(1) = subplot(3,2,1); plot(time, fields.ex(:,n), 'r', 'LineWidth', 2), grid on, xlabel('Time [s]'), ylabel('Field strength [V/m]'), title('E_x') + ax(2) = subplot(3,2,3); plot(time, fields.ey(:,n), 'r', 'LineWidth', 2), grid on, xlabel('Time [s]'), ylabel('Field strength [V/m]'), title('E_y') + ax(3) = subplot(3,2,5); plot(time, fields.ez(:,n), 'r', 'LineWidth', 2), grid on, xlabel('Time [s]'), ylabel('Field strength [V/m]'), title('E_z') + ax(4) = subplot(3,2,2); plot(time, fields.hx(:,n), 'b', 'LineWidth', 2), grid on, xlabel('Time [s]'), ylabel('Field strength [A/m]'), title('H_x') + ax(5) = subplot(3,2,4); plot(time, fields.hy(:,n), 'b', 'LineWidth', 2), grid on, xlabel('Time [s]'), ylabel('Field strength [A/m]'), title('H_y') + ax(6) = subplot(3,2,6); plot(time, fields.hz(:,n), 'b', 'LineWidth', 2), grid on, xlabel('Time [s]'), ylabel('Field strength [A/m]'), title('H_z') set(ax,'FontSize', 16, 'xlim', [0 time(end)]); % Options to create a nice looking figure for display and printing diff --git a/tools/MATLAB scripts/plot_Bscan.m b/tools/MATLAB scripts/plot_Bscan.m index 1b820196..b570d383 100644 --- a/tools/MATLAB scripts/plot_Bscan.m +++ b/tools/MATLAB scripts/plot_Bscan.m @@ -17,7 +17,7 @@ if filename ~= 0 field = input(prompt,'s'); fieldpath = strcat('/rxs/rx1/', field); field = h5read(filename, fieldpath)'; - time = 0:dt:iterations * dt; + time = linspace(0, iterations*dt, iterations)'; traces = 0:size(field,2); fh1=figure('Name', filename);