0% found this document useful (0 votes)
2 views

EXP3 Introduction to matlab

The document introduces MATLAB, a high-performance language for technical computing that emphasizes matrix operations. It provides instructions on starting and quitting MATLAB, as well as an overview of desktop tools and basic commands for effective usage. Additionally, it includes examples demonstrating variable assignments and the effects of specific commands.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

EXP3 Introduction to matlab

The document introduces MATLAB, a high-performance language for technical computing that emphasizes matrix operations. It provides instructions on starting and quitting MATLAB, as well as an overview of desktop tools and basic commands for effective usage. Additionally, it includes examples demonstrating variable assignments and the effects of specific commands.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

LAB ONE

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.

1.1 Starting and Quitting MATLAB

• To start MATLAB, double-click the MATLAB shortcut icon on


your Windows desktop. You will know MALTAB is running when you
see the special " >> " prompt in the MATLAB Command Window.
• To end your MATLAB session, select Exit MATLAB from the File
menu in the desktop, or type quit (or exit) in the Command Window, or
with easy way by click on close button in control box.

1.2 Desktop Tools


1- Command Window: Use the Command Window to enter variables
and run functions and M-files.
2- Command History: Statements you enter in the Command Window
are logged in the Command History. In the Command History, you can
view previously run statements, and copy and execute selected statements.
3- Current Directory Browser: MATLAB file operations use the current
directory reference point. Any file you want to run must be in the current
directory or on the search path.
4- Workspace: The MATLAB workspace consists of the set of variables
(named arrays) built up during a MATLAB session and stored in memory.
5- Editor/Debugger Window: Use the Editor/Debugger to create and
debug M-files.

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.

• A semicolon " ; " at the end of a MATLAB statement suppresses


printing of results.
• If a statement does not fit on one line, use " . . . ", followed by Enter
to indicate that the statement continues on the next line. For
example: >> S= sqrt (225)*30 /... (20*sqrt (100)
• If we don’t specify an output variable, MATLAB uses the variable
ans (short for answer), to store the last results of a calculation.
• Use Up arrow and Down arrow to edit previous commands you
entered in Command Window.
• Insert " % " before the statement that you want to use it as comment;
the statement will appear in green color.

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

You might also like