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: gen_finger.m
    path of file: ./repos/malini/Codes/deconvolution - model/spm8/man/example_scripts
    
    the code of the file until where you have to start completion: function [yy,P,M,U] = gen_finger (sim)
% Generate finger movement data
% FORMAT [yy,P,M,U] = gen_finger (sim)
%
% sim       Simulation data structure:
%
%           .Nt         number of trials
%           .m          first or 2nd order PIF
%           .init       'partial': initial phase diff
%                       restricted to small range
%                       'full': initial phase diff
%                       uniform in 0 to 2 pi
%           .noise_dev  STD of additive noise
%           .do_plot    plot data (1)
%
% yy        yy{n} for nth trial data
% P         model parameters
% M         model structure
% U         input structure


    
function [yy,P,M,U] = gen_finger (sim)
% Generate finger movement data
% FORMAT [yy,P,M,U] = gen_finger (sim)
%
% sim       Simulation data structure:
%
%           .Nt         number of trials
%           .m          first or 2nd order PIF
%           .init       'partial': initial phase diff
%                       restricted to small range
%                       'full': initial phase diff
%                       uniform in 0 to 2 pi
%           .noise_dev  STD of additive noise
%           .do_plot    plot data (1)
%
% yy        yy{n} for nth trial data
% P         model parameters
% M         model structure
% U         input structure

Nr=2; % Number of regions
Nu=0; % Number of between-trial effects

Nt=sim.Nt; % Number of trials

f=6;
fb=2;
fs=100;
dt=1/fs;
secs=1;
N=secs*fs;
U.tims=[1:N]'*dt;

a=0.5;
switch sim.m
    case 1,
        b=0;
    case 2,
        b=0.75*a;
end