aboutsummaryrefslogtreecommitdiff
path: root/solution_stability.m
blob: 359335cb9494ca0965b7871c0b3568d89067cabc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
function [ hist_h, hist_x ] = solution_stability( q_0, q_final, x_final, optics_positions, optics_focal_length, lambda, n_hist, self_flag  )
%Plots histogram of n_hist number of sample points
%Area under plot is equal to the stability of the solution.

lens_displacement = 10^-3;
x = lens_displacement*randn(n_hist,3);

for i=1:n_hist
    xd= x(i,:);
    fitness_array(i) = fitness( q_0, q_final, x_final, optics_positions + xd, optics_focal_length, lambda, self_flag );
end

[hist_h, hist_x] = hist(fitness_array,100);
end