File: MonitorGammaError.m

package info (click to toggle)
psychtoolbox-3 3.0.9%2Bsvn2579.dfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 63,408 kB
  • sloc: ansic: 73,310; cpp: 11,139; objc: 3,129; sh: 1,669; python: 382; php: 272; makefile: 172; java: 113
file content (24 lines) | stat: -rwxr-xr-x 552 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
function err=MonitorGammaError(p,x,y)
% err=MonitorGammaError(p,x,y)
% Returns mean squared error of fit of y data by MonitorGamma function of x. The
% MonitorGamma parameters are x0=p(1) and gamma=p(2). We constrain 0x01 and
% gamma0, and augment the error when they are out of bounds, so that minimization
% will always settle on in-bound values.
%
% Denis Pelli 5/26/96

d=0;
if p(1)<0
	d=p(1).^2;
	p(1)=0;
end
if p(1)>1
	d=(p(1)-1)^.2;
	p(1)=1;
end
if p(2)<0
	d=d+p(2).^2;
	p(2)=0;
end
err=MonitorGamma(x,p(1),p(2))-y;
err=mean(mean(err.^2))+d;