What is MATLAB?
The name MATLAB stands for “MATrix LABoratory” and was originally
designed as a tool for doing
numerical computations with matrices and vectors. It has since grown
into a high-performance language
for technical computing. MATLAB, integrating computation, visualization,
and programming in an easyto-
use environment, allows easy matrix manipulation, plotting of functions
and data, implementation of
algorithms, creation of user interfaces, and interfacing with programs
in other languages. Typical uses
include:
• Math and Computation
• Modeling and Simulation
• Data Analysis and Visualization
• Application Development
• Graphical
User Interface development
Window Layout:
The first time you start MATLAB, the desktop appears with the default
layout, as shown in Figure 1.
The following tools are managed by the MATLAB desktop:
• Command Window: Run MATLAB
statements.
• Current Directory Browser:
To search for, view, open, find, and make changes to MATLAB
related directories and files, use the MATLAB Current Directory browser.
• Command History: Displays a
log of the functions you entered in the Command Window, copy
them, execute them, and more.
• Workspace Browser: Shows
the name of each variable, its value, and the Min and Max calculations,
which MATLAB computes using the min and max functions, and updates
automatically.
In case that the desktop does not appear with the default layout, you
can change it by the menu
Desktop ! Desktop Layout ! Default.
The desktop includes these panels:
Current Folder - This panel allows you to access the project folders and
files.
Command Window - This is the main area where
commands can be entered at the command line. It is indicated by the command
prompt (>>).
In
order to run the program, type the name of the
file containing your program at the prompt. When
typing the filename in the command window do not include
". m". By pressing enter, MATLAB will run your program and
perform all the commands given in your file.
Workspace - The workspace shows all the variables created and/or imported from files.
Command History - This panel shows or rerun commands that are entered at the command line.
You are now faced with the MATLAB desktop on your computer, which contains the prompt
(>>) in the Command Window. Usually, there are 2 types of prompt:
>>For full version
EDU> for educational version
Note:
1. To simplify the notation, we will use this prompt, >>, as a standard prompt sign, though our MATLAB version is for educational purpose.
2. MATLAB adds variable to the workspace and displays the result in the Command Window.
Managing workspace and
file commands Command |
Description |
cd |
Change current directory |
clc |
Clear the Command Window |
clear (all) |
Removes all variables from
the workspace |
clear x |
Remove x from the workspace |
copy file |
Copy file or directory |
delete |
Delete files |
dir |
Display directory listing |
exist |
Check if variables or functions are defined |
help |
Display help for MATLAB functions |
look for |
Search for specified word in all help entries |
mkdir |
Make new directory |
move file |
Move file or directory |
pwd |
Identify current directory |
rmdir |
Remove directory |
type |
Display contents of file |
what |
List MATLAB files in current directory |
which |
Locate functions and files |
who |
Display variables currently in the workspace |
whos |
Display information on variables in the workspace |
MATLAB supports the following commonly used operators and special
characters:
|
Variable names consist of a letter followed by any number of letters, digits or underscore.
MATLAB is case-sensitive.
Variable names can be of any length;
however, MATLAB uses only first N characters, where N is given by the function namelengthmax.
Saving Your Work
The save command is used for saving all the variables in the workspace, as a file with .mat extension, in the current directory.
For example, save myfile
You can reload the file anytime later using the load command.
load myfile .
I highly recommend the MATLAB instruction manual for anyone who is new to MATLAB or wants to improve their understanding of the software. It is a comprehensive and well-written resource that can help users unlock the full potential of MATLAB for their work.
ReplyDeleteVery nicely explained
ReplyDeletePrepare it for scilab also if possible
ReplyDeletevery useful for mathematical operations
ReplyDelete