File: QuestMode.m

package info (click to toggle)
psychtoolbox-3 3.0.19.14.dfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 86,796 kB
  • sloc: ansic: 176,245; cpp: 20,103; objc: 5,393; sh: 2,753; python: 1,397; php: 384; makefile: 193; java: 113
file content (27 lines) | stat: -rw-r--r-- 500 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
function [t,p]=QuestMode(q)
% [t,p]=QuestMode(q)
%
% "t" is the mode threshold estimate
% "p" is the value of the (unnormalized) pdf at t.
% 
% See Quest.

% Denis Pelli, 6/8/96
% 3/1/97 dgp updated to use Matlab 5 structs.
% 4/12/99 dgp dropped support for Matlab 4.

% Copyright (c) 1996-2004 Denis Pelli

if nargin~=1
	error('Usage: t=QuestMode(q)')
end
if length(q)>1
	t=zeros(size(q));
	for i=1:length(q(:))
		t(i)=QuestMode(q(i));
	end
	return
end

[p,iMode]=max(q.pdf);
t=q.x(iMode)+q.tGuess;