At the MATLAB command line, give the command
That will bring up the MATLAB editor. Copy and paste those commands into the edit window that is brought up. When you are done, click the green Run button.
The first time you do that, it will prompt you to select a file name to save the file to; choose something appropriate (must start with an English letter A to Z or a to z, but characters after that can be letters or arabic numerals 0 to 9, or underscore). MATLAB will remember the name you select, and you will not be prompted to choose a name the next time you press the green Run button.