You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: test_example_phase_reset20220113.m
    path of file: ./repos/fieldtrip/test
    
    the code of the file until where you have to start completion: function test_example_phase_reset

% DATA no
% MEM 2gb
% WALLTIME 00:10:00

%
%% Simulate an oscillatory signal with phase resetting
%
%% # Narrow-band oscillation
%
% The following code simulates a clean oscillating signal with a phase reset at time zero.
%
clear all
close all

f = 5;
t = (-1000:1:1000)/1000;

figure
for i=1:10 % repeat 10 times
s = nan(size(t));

    
function test_example_phase_reset

% DATA no
% MEM 2gb
% WALLTIME 00:10:00

%
%% Simulate an oscillatory signal with phase resetting
%
%% # Narrow-band oscillation
%
% The following code simulates a clean oscillating signal with a phase reset at time zero.
%
clear all
close all

f = 5;
t = (-1000:1:1000)/1000;

figure
for i=1:10 % repeat 10 times
s = nan(size(t));
s(t<0 ) = cos(2*pi*f*t(t<0 ) + 2*pi*rand(1)); % random phase
s(t>=0) = cos(2*pi*f*t(t>=0)               ); % constant phase
s = 0.2*s+i;
d(i,:) = s; % remember the signal on each repetition
plot(t, s);
hold on;
end