clc
clear
close all

%% parameters

% simulink
Ts = 1e-6;
ic = 0.1;

% ball and spool
g = 9.81;
m_b = 0.4;
m_s = 0.2;
m_d = 0.1;
r_b = 0.165/2;
r_s = 0.006;
r_d = 0.17;
s = 0.0775/2;

J_b = 2/3*m_b*r_b^2;
J_d = 1/2*m_d*r_d^2;
J_s = 1/2*m_s*r_s^2;
J_d = 2*J_d + J_s;

r = r_d + sqrt(r_b^2-s^2);
r_b = r - r_d;

% initial parameters
tau = 0.05;
b_red = 1;
b = b_red;

% estimated parameters
% tau = 0.047354;
% b_red = 185.99;
% b = b_red;

%% data loading

load data_position_1.mat
signal1 = timeseries(data.data, data.time);

load data_position_2.mat
signal2 = timeseries(data.data, data.time);

load data_position_3.mat
signal3 = timeseries(data.data, data.time);