This repository contains a Matlab code that simulates the optimisation of the mean light intensity within a given region of interest, by shaping the phase of the input wavefront.