How to use MATLAB using Mfiles Double click
How to use MATLAB (using M-files) Double click this icon To start Matlab
This is the interactive Matlab window that will appear.
How do you start a new M-file in MATLAB window. Press “New Script”
This is the window that you get to type in your program (codes)
• Type in your program codes in this window. • End each line with; (except the ones you like to see out put) • Use % for comment
Save your m-files by: Pressing the floppy disk
Select directory and write a file name.
You will have “filename. m”
After saving your M-file, you need to run it by doing the following: Editor > Run
A window will open up with the plot of the three functions, X, Y, Z. Notice that your graph has no title, use “help” command in the MATLAB window to learn how you can add title.
Type in “help plot” in the MATLAB window-- read and learn. >> help plot
Find out how you can use “title” command to add title to your figure. Type “help title” >> help title
After you learn how to use “title” command, use it in your program
See the result of using “title” command in your program
Simple Exercise: • Run the following program, using the guidelines provided in earlier slides. • Include title, xlabel, ylabel • Use help command if necessary • Show output on the monitor to your TA
- Slides: 15