📄 get_xhist.m
字号:
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;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -