forked from lawrennd/noise
-
Notifications
You must be signed in to change notification settings - Fork 1
/
noiseExpandParam.m
30 lines (27 loc) · 1016 Bytes
/
noiseExpandParam.m
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
function noise = noiseExpandParam(noise, params)
% NOISEEXPANDPARAM Expand the noise model's parameters from params vector.
% FORMAT
% DESC returns a noise structure filled with the
% parameters in the given vector. This is used as a helper function to
% enable parameters to be optimised in, for example, the NETLAB
% optimisation functions.
% ARG noise : the noise structure in which the parameters are to be
% placed.
% ARG param : vector of parameters which are to be placed in the
% noise structure.
% RETURN noise : noise structure with the given parameters in the
% relevant locations.
%
% SEEALSO : noiseParamInit, noiseExtractParam
%
% COPYRIGHT : Neil D. Lawrence, 2004, 2005
% NOISE
if isfield(noise, 'transforms')
for i = 1:length(noise.transforms)
index = noise.transforms(i).index;
fhandle = str2func([noise.transforms(i).type 'Transform']);
params(index) = fhandle(params(index), 'atox');
end
end
fhandle = str2func([noise.type 'NoiseExpandParam']);
noise = fhandle(noise, params);