Here is the MATLAB script that was used to generate the figure: hw0p1.m
There are many ways to accomplish a given task in MATLAB, so you're script probably doesn't look exactly like this one. Take a look at the example solution for ideas on how to structure and organize your own scripts.