# Matlab Script ```matlab! %% % Run this section first, then paste arduino data from excel exp_data = [] % Copy data from Excel to exp_data %% % add timestamp data to matlab array (100 Hz) [datalength, col] = size(exp_data); ts = linspace(0, 0.01*datalength, datalength); exp_data = [transpose(ts), exp_data] % exp_data format is performed as: % exp_data = [time(sec), setpoint, encoder_counter(resp.)] %% % plot setpoint plot(exp_data(:,1), exp_data(:,2), 'LineWidth',1) hold on % plot motor response plot(exp_data(:,1), exp_data(:,3), 'LineWidth',1) hold on % plot simulink response plot(out.simout.Time, out.simout.Data, 'LineWidth',1) legend("setpoint", "motor response", "simulink response") hold off xlabel("time (sec)") ylabel("position (count)") % set x range of plot xlim([-1, 6]) grid on ```