function [ E ] = optimalizace(fmin_param, opt_param)
%UNTITLED3 Summary of this function goes here
%   Detailed explanation goes here

T_vz = opt_param{1};
simtime = opt_param{2};
sim_param = opt_param{3};
data_meas = opt_param{4};
fmin_param_names = opt_param{5};

start_values = getstartvalues(data_meas);

[data_sim, ~]= simulace( T_vz, simtime, sim_param, start_values, fmin_param, fmin_param_names);
if data_sim == -1
    data_sim = zeros(size(data_meas))-1;
end
E = kriterium(data_meas, data_sim, opt_param{6});
end

