function PSF = PSFip(phi, age, p, m) %PSFip(phi, age, p, m) Calculates the pointspread function (PSF) based on the % equations espoused by Ijspeert et al. The user must specify the angle, % phi, in degrees. All other values are optional, and will be set at the % following defaults if not specified: % % age = age of subject in years Default age = 0 years % p = pupil diameter in mm Default value = 4 mm. % m = pigmentation parameter Default = call to pigment function % switch nargin case{nargin<1} error 'too few arguments' case{1} age = 0; p = 4; m = pigment; case{2} p = 4; m = pigment; case{3} m = pigment; case{4} case{nargin>=5} error 'too many arguments' end AF = agefact(age); %c and Fbi calculations for given i for i=1:4 switch i case{1} c1 = c1calc(AF, p, m); fBi1 = funBi(i, phi, p, AF, m); case{2} c2 = c2calc(AF, p, m); fBi2 = funBi(i, phi, p, AF, m); case{3} c3 = c3calc(AF, m); fBi3 = funBi(i, phi, p, AF, m); case{4} c4 = c4calc(AF, m); fBi4 = funBi(i, phi, p, AF, m); end end %Normalization of c to sum to 1 ctotal = (c1 + c2 + c3 + c4); %PSF calculations PSF1 = (c1/ctotal) * fBi1; PSF2 = (c2/ctotal) * fBi2; PSF3 = (c3/ctotal) * fBi3; PSF4 = (c4/ctotal) * fBi4; %Addition of the four final components PSF = PSF1 + PSF2 + PSF3 + PSF4;