#!/usr/bin/env octave-cli

addpath("../../octave/");
defaults;

# Values from Abarcus
values_v05 = csvread("prismatic-n6-v0.5-_drawn.log.csv");
time = values_v05(:, 1);
draw_v05 = values_v05(:, 2);
force_v05 = values_v05(:, 3);
Ep_total_v05 = values_v05(:, 4);

values_v1 = csvread("prismatic-n6-v1-_drawn.log.csv");
time = values_v1(:, 1);
draw_v1 = values_v1(:, 2);
force_v1 = values_v1(:, 3);
Ep_total_v1 = values_v1(:, 4);

values_v2 = csvread("prismatic-n6-v2-_drawn.log.csv");
time_v2 = values_v2(:, 1);
draw_v2 = values_v2(:, 2);
force_v2 = values_v2(:, 3);
Ep_total_v2 = values_v2(:, 4);

clf;
p1 = figure();
hold on;
	plot(draw_v05, -force_v05, "r");
	plot(draw_v1, -force_v1, "g");
	plot(draw_v2, -force_v2, "b");
hold off;
xlabel('$d\,[\metre]');
ylabel('$F\,[\newton]');
h = legend('rychlost nátahu $0{,}5\ \metre\per\second$',
		   'rychlost nátahu $1{,}0\ \metre\per\second$',
		   'rychlost nátahu $2{,}0\ \metre\per\second$');
legend_settings(h);
legend("location", "northwest");
grid on;
box off;
deccomma;
print(p1, "draw_velocity", "-depslatex", "-color");

clf;
p2 = figure();
hold on;
	plot(draw_v05, -force_v05, "r");
	plot(draw_v1, -force_v1, "g");
	plot(draw_v2, -force_v2, "b");
hold off;
xlabel('$d\,[\metre]');
ylabel('$F\,[\newton]');
axis([0.6-eps 0.8+eps 500 700]);
h = legend('rychlost nátahu $0{,}5\ \metre\per\second$',
		   'rychlost nátahu $1{,}0\ \metre\per\second$',
		   'rychlost nátahu $2{,}0\ \metre\per\second$');
legend_settings(h);
legend("location", "northwest");
grid on;
box off;
deccomma;
print(p2, "draw_velocity2", "-depslatex", "-color");
