AER444/MAT3334/MAT3444/MAT6334
MATLAB overview
Copyright © University of Sheffield 1
Top tips to remember
• Computer code is a list of instructions
• Generally each instruction is simple
• KEY to writing computer code is to break it into simple steps
• Easier to solve the small steps
• And……don’t panic
Copyright © University of Sheffield 2
Why MATLAB?
• Used in industry and academia
• Easy interface
• Lots of in built functions (e.g., trigonometric, interpolation,etc)
• Can plot and visualise data easily
• Available through the university
Copyright © University of Sheffield 3
Suggested approach to Coding
• What is the problem
• What is the input and output
• Work out some key solutions by hand
• Develop a MATLAB solution
• Test the MATLAB solution
Copyright © University of Sheffield 4
What are we going to cover
• The MATLAB environment
• How to enter numbers
• What an m-file is
• How to work with ‘live’ scripts
Copyright © University of Sheffield 5
The MATLAB Environment
• Help available from:
• Help menu -> MATLAB Help
• >> help
• You will be confronted with a number of windows
1. Command window – instructions
2. Workspace – variables are stored here
3. Current Directory – available files (check)
4. Command History – previous instructions
5. Menus – usual Windows options
Copyright © University of Sheffield 6
The MATLAB Environment
Working current directory
Function catalogue Help
Menus
Current
directory
content Command Workspace
window (variable list)
File details
Copyright © University of Sheffield 7
MATLAB m-files
• A MATLAB m-file is a text file where you can write MATLAB
commands.
• When the m-file is run, MATLAB reads the command lines and
executes them.
• All m-files must end with the extention .m
• filename.m
Copyright © University of Sheffield 8