% Detect stationary sections in the given signal.

%% init
clear;                          % clear workspace
close all;                      % close opened figures

%% defines
Fs = 1000;                      % Accel data is recorded with 1000 hz = 0.001 s
Ts = 1/Fs;                      % time resulting from frequency

%% Step 1: Load profile
addpath('C:\Users\nikof\Documents\MATLAB\Matlab Files');  % Define path with profiles

%% Profiles with position reference on test appliance
load('Profil_34');              % Elevator movement on test appliance
                                % (move, stop, move....)

%% Load data
position_ref = AccelData(2,1:end);

% Time vector -> depends on length of input data
t = 0:Ts:((length(position_ref)-1)*(1/Fs));

%% Plot results

figure('Name','position','NumberTitle','off')
plot(t,position_ref,'k');
grid on;
title('position');
xlabel('time [s]');
ylabel('position [m]');
axis([0 (t(end)-1/Fs) -0.5 2]);