0% found this document useful (0 votes)
29 views68 pages

2 Matrix Manipulation

This document provides an introduction to MATLAB. It discusses variables which do not require declaration or initialization and can be assigned using the assignment operator. Functions can contain input and output arguments, for and if statement blocks, and have documentation accessed with help. Functions can return multiple outputs in a matrix.

Uploaded by

Jay Pandia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views68 pages

2 Matrix Manipulation

This document provides an introduction to MATLAB. It discusses variables which do not require declaration or initialization and can be assigned using the assignment operator. Functions can contain input and output arguments, for and if statement blocks, and have documentation accessed with help. Functions can return multiple outputs in a matrix.

Uploaded by

Jay Pandia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 68

INTRODUCTION TO

MATLAB
Matlab Desktop

Workspace /
Current Directory
Command Window

Command
History

Explore the Matlab Desktop


Introduction to Matlab
6
Sumitha Balasuriya
Variables
• Don’t have to declare type
• Don’t even have to initialise
• Just assign in command window
>>
>> a=12; % variable a is assigned 12

Matlab comment
prompt operator
suppress
assign
command
operator
output
Try the same line without
the semicolon and
Introduction to Matlab comments
18
Sumitha Balasuriya
Functions (continued)
function name input
>> I=iterate(5) output
I=
1 4 9 16 25

function keyword

help lines for function

for statement block


Access the comments of
your Matlab functions
>> help iterate Make sure you save changes to the
m-file before you call the function!
Introduction to Matlab
52
Sumitha Balasuriya
Functions (continued)
Functions can have many
>> [i j]=sort2(2,4) outputs contained in a
matrix
i=
4
j=
2
>> if
statement
block

Remember to use the


Matlab help command for
syntax
>> help if

Introduction to Matlab
53
Sumitha Balasuriya

You might also like