EXP3 Introduction to matlab
EXP3 Introduction to matlab
INTRODUCTION TO MATLAB
1. Introduction
MATLAB is a high-performance language for technical computing. It
integrates computation, visualization, and programming in an easy-to-use
environment where problems and solutions are expressed in familiar
mathematical notation.
The name MATLAB stands for matrix laboratory. MATLAB was
originally written to provide easy access to matrix.
2. Basic Commands
• clear Command: Removes all variables from workspace.
• clc Command: Clears the Command window and homes the cursor.
• help Command: help displays help about that Topic if it exist.
• lookfor Command: Provides help by searching through all the first lines
of MATLAB help topics and returning those that contains a key word you
specify.
• edit Command: enable you to edit (open) any M-file in Editor Window.
This command doesn’t open built-in function like, sqrt. See also type
Command.
• more command: more on enables paging of the output in the MATLAB
command window, and more off disables paging of the output in the
MATLAB command window.
Example 1:
Try to type the following assignment:
>> x = 2
x=
2
>> t = x + a
Undefined function or variable 'a'.
Rewrite The above sequences in correct form
>> x = 2
x=
2
>> a = 3.5
a=
3.5000
>> t = x + a
t=
5.5000
Example 2:
Now Try to do the following:
>> a=3
>> a=3; can you see the effect of semicolon " ; "
>> a+5 assign the sum of a and 5 to ans
>> b=a+5 assign the sum of a and 5 to b
>> clear a
>> a can you see the effect of clear command
>> clc clean the screen
>> b