File: QuestPdf.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 (28 lines) | stat: -rw-r--r-- 628 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
28
function p=QuestPdf(q,t)
% p=QuestPdf(q,t)
% 
% The (possibly unnormalized) probability density of candidate threshold "t".
% q and t may be vectors of the same size, in which case the returned p is a vector of that size.
% 
% See Quest.

% Denis Pelli
% 5/6/99 dgp wrote it
% Copyright (c) 1996-1999 Denis Pelli

if nargin~=2
	error('Usage: p=QuestPdf(q,t)')
end
if size(q)~=size(t)
	error('both arguments must have the same dimensions')
end
if length(q)>1
	p=zeros(size(q));
	for i=1:length(q(:))
		p(i)=QuestPdf(q(i),t(i));
	end
	return
end
i=round((t-q.tGuess)/q.grain)+1+q.dim/2;
i=min(length(q.pdf),max(1,i));
p=q.pdf(i);