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

Intro To Matlab

MATLAB is a programming platform designed for engineers and scientists to analyze and design systems. It allows matrix manipulations, plotting of functions and data, algorithm implementation, and interfacing with other languages. The document introduces basic MATLAB concepts like data types, variables, matrices, arrays, and plotting.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Intro To Matlab

MATLAB is a programming platform designed for engineers and scientists to analyze and design systems. It allows matrix manipulations, plotting of functions and data, algorithm implementation, and interfacing with other languages. The document introduces basic MATLAB concepts like data types, variables, matrices, arrays, and plotting.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

CPE 405L

Digital Signal Processing Laboratory

Introduction to
Introduction to MATLAB

What is MATLAB?

MATLAB screen (website)

Basic Data & Variables

Matrices & Arrays

2D Plotting
What is MATLAB?
MATLAB ® is a programming platform designed specifically
for engineers and scientists to analyze and design systems
and products that transform our world. The heart of MATLAB
is the MATLAB language, a matrix-based language allowing
the most natural expression of computational mathematics.

MATLAB can be thought of a super-powerful graphing


calculator.
What is MATLAB?
• MATLAB stands for MATrix LABoratory.
• It is developed by MathWorks
• MATLAB allows matrix manipulations, plotting of functions and data,
implementation of algorithms, creation of user interfaces, and
interfacing with programs written in other languages
• It was designed by Cleve Moler in the late 1970s and was initially
intended to be a simple interactive matrix calculator
• As of 2020, MATLAB has more than 4 million users worldwide.
What is MATLAB?
• Latest version: Version 23.2 R2023b
• Released date: Sept 13, 2023
Introduction to MATLAB

Go to https://matlab.mathworks.com/

If asked to sign-in on MathWorks, use your BulSU account.


Current
Directory

Command window

Workspace
Current
Directory

Command window

Workspace
Current
Directory

Command window

Workspace
Basic Data & Variables
Basic Data & Variables
• MATLAB is a “weakly typed” language
• MATLAB supports various types: the most popular ones:
• 3.84 (64-bit double-default)
• ‘A’ (16-bit character)
• Most variables you’ll deal with are vectors, matrices, doubles or
chars
• Other types: comlex, symbolic, 16-bit and 8-bit integers, etc.
Basic Data & Variables
ARITHMETIC OPERATOR AND THEIR PRECEDENCE
Basic Data & Variables
MATHEMATICAL FUNCTIONS
Basic Data & Variables
VARIABLE NAME RULES:
• First character MUST be a letter
• After that, any combination of numbers, letters, and _
• Names are CASE-SENSITIVE (e.g. var1 is different from Var1)
Basic Data & Variables
PRE-DEFINED VARIABLES & KEYWORDS
Basic Data & Variables
MANAGING VARIABLES
Basic Data & Variables
SAVE/CLEAR/LOAD
Matrices & Arrays
Matrices & Arrays
CREATING AN ARRAY
Matrices & Arrays
CREATING AN ARRAY (long)
Matrices & Arrays
GENERATING VECTORS FROM FUNCTIONS

1. zeros(M,N) MxN matrix of zeros


2. ones(M,N) MxN matrix of ones
3. rand(M,N) MxN matrix of uniformly distributed random numbers on
(0,1)
Matrices & Arrays
ARRAY OPERATIONS
Matrices & Arrays
VECTOR INDEXING MATRIX INDEXING
• MATLAB Indexing start with 1 not 0. • MATLAB Indexing start with 1 not 0.
Plotting
EXAMPLE 1:
Plot the function sin(x) between � ≤ � ≤ ��

- create an x-array of 100 samples between 0 and 4�


- calculate sin() of the x-array
- plot the array
Plotting
EXAMPLE 2:
Plot the function � = �−�/� ���(�) between � ≤ � ≤ ��

- create an x-array of 100 samples between 0 and 4�


- plot the y-array
Plotting
Plotting
Plotting
CPE 405L
Digital Signal Processing Laboratory

Thank you!
Do you have any questions?

_______________________
Email: [email protected]

You might also like