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

Matlab Introduction

MATLAB is a high-level technical computing language where almost everything is represented as a matrix. The MATLAB environment has components like the Workspace, Command Window, and File Editor Window. Matrices and vectors can be easily defined and manipulated in MATLAB. Common operations include creating matrices and vectors, finding their size and order, transposing them, and generating matrices with predefined values like zeros, ones, random numbers and more.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPSX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views

Matlab Introduction

MATLAB is a high-level technical computing language where almost everything is represented as a matrix. The MATLAB environment has components like the Workspace, Command Window, and File Editor Window. Matrices and vectors can be easily defined and manipulated in MATLAB. Common operations include creating matrices and vectors, finding their size and order, transposing them, and generating matrices with predefined values like zeros, ones, random numbers and more.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPSX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Introduction to MATLAB

What is MATLAB
High level language for technical
computing
Stands for MATrix LABoratory
Everything is a matrix - easy to do
linear algebra

The MATLAB Environment


MATLAB window
components:
Workspace
> Displays all the defined
variables

Command Window
> To execute commands
in the MATLAB
environment

Command History
> Displays record of the
commands used

File Editor Window


> Define your functions

Matrices & Vectors


All (almost) entities in MATLAB are
matrices
>> A = [16 3; 5 10]
3
Easy to define: A = 16
5

10

Use , or to separate row


elements -- use ; to separate rows

Matrices & Vectors - II


Order of Matrix mn

m=no. of rows, n=no. of columns

Vectors - special case


n=1
m=1

column vector
row vector

Creating Vectors and Matrices


Define

>> A = [16 3; 5 10]


A =
16
3
5
10
>> B = [3 4 5
6 7 8]
B = 3 4 5
6 7 8

Transpose
Vector :

>> a=[1 2 3];


>> a'
1
2
3

Matrix:

>> A=[1 2; 3 4];


>> A'
ans =
1
3
2
4

Creating Vectors
Create vector with equally spaced intervals

>> x=0:0.5:pi
x =
0 0.5000 1.0000 1.5000 2.0000 2.5000 3.0000
Create vector with n equally spaced intervals

>> x=linspace(0, pi, 7)


x =
0 0.5236 1.0472 1.5708 2.0944 2.6180 3.1416
Equal spaced intervals in logarithm space

>> x=logspace(1,2,7)
x =
10.0000 14.6780 21.5443 68.1292

100.0000

Note:MATLABusespitorepresent,usesiorjtorepresent
imaginaryunit

Creating Matrices

zeros(m, n): matrix with all zeros


ones(m, n): matrix with all ones.
eye(m, n): the identity matrix
rand(m, n): uniformly distributed random
randn(m, n): normally distributed random
magic(m): square matrix whose elements

have the same sum, along the row,


column and diagonal.
pascal(m) : Pascal matrix.

THANK YOU

You might also like