diff options
-rw-r--r-- | fitter_check.m | 2 | ||||
-rw-r--r-- | solution_stability.m | 7 | ||||
-rw-r--r-- | solution_visualization.m | 2 | ||||
-rw-r--r-- | stability_visualization.m | 18 |
4 files changed, 24 insertions, 5 deletions
diff --git a/fitter_check.m b/fitter_check.m index dd87775..5ae2ac4 100644 --- a/fitter_check.m +++ b/fitter_check.m @@ -24,7 +24,9 @@ n_truncate = 3; %number of digits in truncated solution [ possible_lens_placement_uniq, possible_lens_placement, possible_sample_energy, possible_lens_set, index ] = remove_similar_soln( possible_sample_energy, possible_lens_placement, possible_lens_set, n_truncate ); n_visualizations = 5; %number of best solutions to visualize +n_hist = 10000; pick_visualization( possible_sample_energy, possible_lens_placement_uniq, possible_lens_placement, possible_lens_set, index, n_visualizations, q0, qf, Ltot, lambda ); +stability_visualization( possible_lens_placement_uniq, q0, qf, xf, possible_lens_placement, possible_lens_set, lambda, n_visualizations, n_hist, index ) % %Visualize fitness function for fixed f2 and f3 diff --git a/solution_stability.m b/solution_stability.m index f3363b1..324621f 100644 --- a/solution_stability.m +++ b/solution_stability.m @@ -1,11 +1,10 @@ -function [ hist_h, hist_x ] = solution_stability( q_0, q_final, x_final, optics_positions, optics_focal_length, lambda ) +function [ hist_h, hist_x ] = solution_stability( q_0, q_final, x_final, optics_positions, optics_focal_length, lambda, n_hist ) %SOLUTION_STABILITY Summary of this function goes here % Detailed explanation goes here -n = 10000; lens_displacement = 10^-3; -x = lens_displacement*randn(n,3); +x = lens_displacement*randn(n_hist,3); -for i=1:n +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 ); end diff --git a/solution_visualization.m b/solution_visualization.m index 2cf8ce7..6f8fddb 100644 --- a/solution_visualization.m +++ b/solution_visualization.m @@ -13,7 +13,7 @@ q_backward=gbeam_propagation(x,qf,xf,optics); [w_backward,r_backward]=q2wr(q_backward, lambda); %Plot beam profile -plot ( ... +subplot(2,1,1); plot ( ... x,w_forward, '-r', ... x,-w_forward, '-r', ... x, w_backward, '-.b', ... diff --git a/stability_visualization.m b/stability_visualization.m new file mode 100644 index 0000000..86d3836 --- /dev/null +++ b/stability_visualization.m @@ -0,0 +1,18 @@ +function [hist_h, hist_x] = stability_visualization( possible_lens_placement_uniq, q0, qf, xf, optics_position, optics_set, lambda, n, n_hist, index ) +%STABILITY_VISUALIZATION Summary of this function goes here +% Detailed explanation goes here + +n_possible_lens_placement = min(n, size(possible_lens_placement_uniq,1)); + +for i=1:n + figure(i) + [hist_h, hist_x] = solution_stability( q0, qf, xf, optics_position(index(i),:), optics_set(index(i),:), lambda, n_hist ); + subplot(2,1,2); plot(hist_x, hist_h); + area = trapz(hist_x, hist_h); + str_n = ['# of test points = ', num2str(n_hist)]; + str_a = ['Area under curve = ', num2str(area)]; + title({'Solution Stability'; str_n; str_a}); +end + +end + |