Source: https://faculty.washington.edu/etsb/workshops/signal_processing_feedforward_networks/matlab_tutorial_workshops.pdf