clear all
close all
clc

data = csvread('Results/recorded_phua.csv');
data_2 = csvread('Results/recorded_phua_theoretical.csv');

time = data(:,1);
time = ((time)/100000);
phua_x = data(:,2);
phua_y = data(:,3);
phua_z = data(:,4);

phua_x_theo = data_2(:,2);
phua_y_theo = data_2(:,3);
phua_z_theo = data_2(:,4);

hfigure=figure('position', [80 80 420 320], 'color', [1 1 1]);
[hAx,hLine1,hLine2] = plotyy([time, time, time, time], [phua_x_theo, phua_y_theo, phua_x, phua_y], [time, time], [phua_z_theo, phua_z]);

grid on
box on

AxisFontName = 'Helvetica';
AxisFontSize = 9;

set(hAx(2),'xticklab',[],'xtick',[])

set(hLine1(1), 'color', [1 0.5 0], 'LineWidth',0.5)
set(hLine1(2), 'color', [0.13 0.55 0.13], 'LineWidth',0.5)
set(hLine2(1), 'color', [0.3 0.6 1], 'LineWidth',0.5)

set(hLine1(3), 'color', 'r', 'LineWidth',0.5)
set(hLine1(4), 'color', 'g', 'LineWidth',0.5)
set(hLine2(2), 'color', 'b', 'LineWidth',0.5)
set(hAx(1),'YColor','k')
set(hAx(2),'YColor','k')

legend([hLine1(1);hLine1(2);hLine2(1);hLine1(3);hLine1(4);hLine2(2)],'PHUA_{x} (theoretical)', 'PHUA_{y} (theoretical)', 'PHUA_{z} (theoretical)','PHUA_{x}','PHUA_{y}','PHUA_{z}')

set(hAx(1), 'YLim', [-0.15 0.15], 'YTick', -0.15:0.03:0.15, 'FontName', AxisFontName, 'FontSize', AxisFontSize)
set(hAx(2), 'YLim', [0 0.500], 'YTick', 0:0.05:0.5, 'FontName', AxisFontName, 'FontSize', AxisFontSize)

set(hAx, 'XLim', [0 20], 'XTick', 0:2:20, 'FontName', AxisFontName, 'FontSize', AxisFontSize);

title('PHUA Position', 'Fontsize', AxisFontSize, 'FontName', AxisFontName)
set(get(hAx(1),'Xlabel'), 'String', 'Time [s]', 'FontName', AxisFontName, 'FontSize', AxisFontSize)
set(get(hAx(1),'Ylabel'), 'String', 'X and Y Position [m]', 'FontName', AxisFontName, 'FontSize', AxisFontSize)
set(get(hAx(2),'Ylabel'), 'String', 'Z Position [m]', 'FontName', AxisFontName, 'FontSize', AxisFontSize)

export_fig phua_position -pdf -transparent