You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

35 lines
899 B

using Plots
using CSV
pyplot()
file_measure = "linear_x2.csv"
file_input = "input_linear_x2.csv"
measure = CSV.read(file_measure, header=false) |> Matrix{Float64};
command = CSV.read(file_input, header=false) |> Matrix{Float64};
init_measure = 1
end_measure = 20
init_command = 30
for (i,t) in enumerate(measure[:,1])
global init_measure = i
if t >= command[init_command,1]
break
end
end
plot(
measure[init_measure:end-end_measure,1],
measure[init_measure:end-end_measure,2],
title="plop",
size=(1000, 600)
)
s = sum([x * (measure[init_command + i,1] - measure[init_command + i-1,1]) for (i,x) in enumerate(measure[init_measure:end-end_measure,2])]) / (measure[end-end_measure,1] - measure[init_measure,1])
plot!([measure[init_measure,1], measure[end-end_measure,1]], [s, s])
plot!(
command[init_command:end,1],
command[init_command:end,2]
)
show()