Slight edits ... more to come.  Added the normalpdf to reduce reliance on statistics toolbox