File: WlsToT.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 (35 lines) | stat: -rw-r--r-- 988 bytes parent folder | download | duplicates (4)
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
29
30
31
32
33
34
35
function T = WlsToT(wls,sd)
% T = WlsToT(wls,[sd])
%
% Produce the identity color matching matrix associated
% with the passed wavelength sampling.
%
% Arguments may be either [start delta n] description or
% a list of wavelengths.
%
% The second input sd is the standard deviation of a Gaussian
% blur function which may be incorporated into the T matrix
% if desired.
%
% This second feature should be used with some
% caution, as I haven't thought it completely through.  The
% current implementation normalizes each row of T so that the
% entries sum to 1.  This seems as if it is what we want to
% get answers consistent with what we get when we don't
% incorporate wavelength blurring.
%
% 7/11/03  dhb  A few comments added.

% Force into wavelength representation.
wls = MakeItWls(wls);

[m, n] = size(wls);
if nargin == 1
    T = eye(m,m);
else
    T = zeros(m,m);
    for i = 1:m
        T(i,:) = NormalPDF(wls,wls(i),sd^2)';
        T(i,:) = T(i,:) / sum(T(i,:)');
    end
end