function xhist = get_xhist(choice_vector) % [XHIST] = get_xhist(CHOICE_VECTOR) % % Converts an input choice vector into a trajectory of values between 0 and % 1 that represent the user's allocation of button presses to A over the % last 40 button presses. Uses a smooth buffer implementation % % Required: % CHOICE_VECTOR - The vector of choices given by the user (e.g. c1(:,1)') % % The output argument is XHIST % % Examples: % For the examples described in our project % % >> xhist = get_xhist(c1(:,1)'); buffer = 0.5*ones(1,40); xhist = zeros(size(choice_vector)); for i=1:length(choice_vector), buffer = [choice_vector(i) buffer(1:end-1)]; xhist(i) = mean(buffer); buffer = xhist(i)*ones(1, 40); end;