3 %Function calculates the derivative of the
function U
using detailed
6 % This
function is meant
for verification of the calculation of the
7 % derivative
using reduced simulations.
9 % Markus Dihlmann 25.06.2010
14 U_der = zeros(size(model_data.W,1),model.nt+1,length(get_mu_to_optimize(model)));
16 h_range = 100; %
for constructing the difference quotient: how small is the variaton of the parameter
18 sim_data = detailed_simulation(model, model_data);
22 h = (model.mu_ranges{k}(2)-model.mu_ranges{k}(1))/h_range; % ranges must be intervals
23 if model.optimization.params_to_optimize(k) == 1
25 if model.mu_ranges{k}(2)-mu0(k) >= h % is it possible to
get the righthanded difference quotient?
27 model = set_mu(model,mu0);
28 sim_data = detailed_simulation(model, model_data); %value of the functional after changing one parameter
29 U_der(:,:,i) = (1/h) * (sim_data.U-U0);
31 model = set_mu(model,mu0);
34 model = set_mu(model,mu0);
35 sim_data = detailed_simulation(model, model_data); %value of the functional after changing one parameter
36 U_der(:,:,i) = (1/h) * (-sim_data.U+U0);
38 model = set_mu(model,mu0);
function U_der = calculate_derivative(model, model_data)
Function calculates the derivative of the function U using detailed simulation.