2 %
function [model] = change_x(model,x,t,d)
3 %Funcion sets the parameters that are to be optimized to the values given
5 %Also usable
for optimization:
function sets the parameters to x+t*d
if t
8 %Required fields of model:
9 % model.mu_names: field with the names of the paramters that are to be
11 % model.??? all the fields that are given in model.mu_names and are to be
13 % model.optimization.params_to_optimize: which parameters are to be changed?
15 % x : the current setting of the parameters (should have the same length as there
16 % are ones in model.optimization.params_to_optimize, i.e. the number of parameters that are to be optimized)
19 % d : the search direction (i.e. the gradient in gradient search)
21 % Oliver Zeeb 07.06.10
23 if length(varargin) > 0
26 %error(
'more implementation needed here')
32 if length(x)~=length(get_mu(model))
33 error('implement exception for params to
optimize here!')
35 %check if x+t*d is inside model bounds
37 mu_ranges = model.mu_ranges;
38 if(length(mu_next) == length(mu_ranges))
39 for i=1:length(mu_ranges)
40 if mu_next(i)<mu_ranges{i}(1)
41 mu_next(i) = mu_ranges{i}(1);
42 elseif mu_next(i)>mu_ranges{i}(2)
43 mu_next(i) = mu_ranges{i}(2);
47 model = set_mu(model,mu_next);
50 %
for k=1:length(model.optimization.params_to_optimize)
51 %
if model.optimization.params_to_optimize(k) == 1
52 % model.(model.mu_names{k}) = x(l)+t*d(l);
function model = set_mu_to_optimize(model, x, varargin)
Funcion sets the parameters that are to be optimized to the values given by x Also usable for optimiz...
function [ opt_data , model ] = optimize(model, model_data, detailed_data, reduced_data)
opt_data = optimize(model, model_data, detailed_data, reduced_data)