SlideShare a Scribd company logo
Introduction: MATLAB
Kenya Alfaro
Jairo Maldonado
Overview
› Introduction - What is MATLAB?
› How Does It Look?
› Important MATLAB Terms
› Getting the MATLAB Software
› Arithmetic Operations and Mathematical
Functions
› Conditions
› Creating Arrays Matrices
› Array Operators
› Data Manipulation
› Math Function
› Plotting
› If-elseif-else statements
› FOR Loops
› WHILE Loops
› Functions
› Relevance
› Problem
Introduction - What is MATLAB?
MATLAB is a high-performance language for
technical computing (A very big calculator).
Data Analysis Serial
Communication
Calculations
Command Window:
Single-line code execution
Editor’s Window:
Edit scripts/functionsWorkspace
Window:
Saved variables
Editor Tab: Edit scripts and functions
Run: Execute scripts
New: Create
scripts/functions
Getting the MATLAB Software
1. Google: CSULB Software Depot
2. Login to the Depot
3. Search: matlab
4. Add to Cart
5. Check out
Arithmetic Operations and Mathematical
Functions
Symbols Description
+ Add expression
- Negative of an expression
* Multiply expression
/ Divide expression
^ Raising an expression to a power
Conditions
● Is the condition true?
● True = 1 ● False = 0
Equal To Greater
Than
Less Than Great Than
Or Equal To
Not Equal
To
== > < >= ~=
Example:
1. 5 == (225/45)
2. 2^3 > (2+7)
3. (11*9) < (108-5)
Creating Arrays
● 3 ways to create an array in row
○ [ _ _ _ ];
○ Start : Increment : End;
○ Linspace(Start, End, Amount of Points);
● Convert to Column
○ [ _ _ _]’;
○ transpose(array);
Matrices
● Semicolon creates a new row
● A = [ _ _ _ ; _ _ _ ; _ _ _];
● Ex:
B =
1 2 3
0 5 0
7 0 9
● Join matrices
○ [ B A] horizontally
○ [ B;A] vertically
Array Operators
Symbols Description
+ Add expression
- Negative of an expression
* or .* Multiply expression
/ or ./ Divide expression
^ or .^ Raising an expression to a
power
● Period creates element by element arithmetic
Data Manipulation
● Find data in a matrix using rows and columns
○ data = variable(row, column)
● Use find( ) to manipulate data in an array or matrix
○ [row,column] = find(data, indices returned)
○ [row,column] = find(use conditional statement)
● Use both
Ex:
1. [r,c] = find(B)
2. B(2,3)
3. B(find(B))
Math Functions
● mod(a,m)
● min(B)
● max(B)
● isempty(B)
● abs(x)
● exp(x)
● log10(x)
● sqrt(x)
● sin(x)
● sind(x)
● rand(x)
● zeros(row,col)
● ones(row,col)
● eye(row,col)
Plotting
plot(x,y,LineSpec)
● x=data to be plotted on x-axis
● y=data to be plotted on y-axis (must be same
length as x)
● LineSpec=specify line/point color, shape, pattern
or thickness
xlabel/ylabel(‘LabelName’)
● LabelName will be displayed on respective axis
title(‘TitleName’)
● TitleName will be displayed on top of graph
hold on/hold off
● helps plot multiple plots in the same figure
legend(‘Name1,Name2’)
● Creates a legend for line(s)
Day Temperature
(F)
X Y
1 86
2 88
3 90
4 86
5 81
6 80
7 79
Ex. Plotting Weekly
Temperature Data
Ex. Plotting Weekly
Temperature Data of LA and
SF
Day Temperature (F)
Los Angeles
Temperature (F)
San Fransisco
1 86 60
2 88 62
3 90 65
4 86 68
5 81 66
6 80 69
7 79 70
Add: hold on/off & legend
“if-elseif-else” Statements
Example:
A = ones(2,3);
B = rand(3,4);
If (isequal(size(A),size(B)))
C = [A,B];
else
disp(‘A and B are not the same
size.’)
C = [ ];
end
if (expression)
statements
elseif (expression)
statements
else
statements
end
Loops
There are 2 types of loops:
● FOR loops
● WHILE loops
Loops must also be closed with and END
Loops can be broken using BREAK
FOR Loops
Example:
x=[5,4,8,7,10]
z=[];
for i=1:5 % amount of iterations
z(i)=x(i)*2 %do something
end % always end
RESULT:
z=[10,8,16,14,100]
FOR Loops and Conditional Statements
Example:
x=[5,4,8,7,0,10]
z=[];
for i=1:6
If x(i)==0 % can add if-else in
loop
Break; % stops the code
else
z(i)=x(i)*2
end
end
RESULTS:
z=[10,8,16,14]
WHILE Loops
Example:
x=0;
while x<10 % continue until condition is false
x=x+1;
end
RESULT:
x=10
Functions
● Function: Functions, written in
scripts, are used to simplify entire
scripts into one function with
inputs and outputs
○ A function behave like: y = mx +b,
where y=output & x=input
● In script:
function [output] = name[input]
do something
end
● In command window
out = name(in);
Relevance
For Electrical Engineers
● Computational biology
● Image and video
processing
● Optimization
● Partial Differential
Equations
● Signal Processing and
Communications
● Statistical and Data
Analysis
● Etc
For Mechanical Engineering
● Statics and Dynamics
● Mechanical Vibrations
● Numerical Methods
● Finite Element Analysis
Problems

More Related Content

PPTX
Microprocessor 8085 complete
PPTX
Seminar on MATLAB
PPTX
Matlab Functions
PPTX
Context free grammar
PPTX
Interrupts on 8086 microprocessor by vijay kumar.k
PPTX
Depth first search [dfs]
PPTX
Matlab ppt
PPTX
Assembly Language
Microprocessor 8085 complete
Seminar on MATLAB
Matlab Functions
Context free grammar
Interrupts on 8086 microprocessor by vijay kumar.k
Depth first search [dfs]
Matlab ppt
Assembly Language

What's hot (20)

PPTX
Finite State Machine.ppt.pptx
PPTX
Automata theory -Conversion of ε nfa to nfa
PDF
Criteria-III-NBA.pdf
PPTX
Timing and control
PPSX
Files in c++
PPT
Introduction state machine
PPT
FPGA Configuration
PDF
Lec 07 - ANALYSIS OF CLOCKED SEQUENTIAL CIRCUITS
PDF
Fast Fourier Transform
PPTX
COMPUTER INSTRUCTIONS & TIMING & CONTROL.
PPTX
8085 MICROPROCESSOR ARCHITECTURE AND ITS OPERATIONS
PPT
SINGLE-SOURCE SHORTEST PATHS
PPTX
Moore and mealy machine
PPTX
Data Structures - Lecture 9 [Stack & Queue using Linked List]
PPTX
Data Structures - Lecture 7 [Linked List]
PDF
NFA to DFA
PDF
Architecture of 8051 Microcontroller.pdf
PPTX
Floating point arithmetic operations (1)
PPT
Infix prefix postfix
PPT
8255 presentaion.ppt
Finite State Machine.ppt.pptx
Automata theory -Conversion of ε nfa to nfa
Criteria-III-NBA.pdf
Timing and control
Files in c++
Introduction state machine
FPGA Configuration
Lec 07 - ANALYSIS OF CLOCKED SEQUENTIAL CIRCUITS
Fast Fourier Transform
COMPUTER INSTRUCTIONS & TIMING & CONTROL.
8085 MICROPROCESSOR ARCHITECTURE AND ITS OPERATIONS
SINGLE-SOURCE SHORTEST PATHS
Moore and mealy machine
Data Structures - Lecture 9 [Stack & Queue using Linked List]
Data Structures - Lecture 7 [Linked List]
NFA to DFA
Architecture of 8051 Microcontroller.pdf
Floating point arithmetic operations (1)
Infix prefix postfix
8255 presentaion.ppt
Ad

Similar to Matlab Workshop Presentation (20)

PDF
Basics of programming in matlab for beginners
PDF
Dsp lab _eec-652__vi_sem_18012013
PDF
Dsp lab _eec-652__vi_sem_18012013
PPTX
PDF
Matlab for beginners, Introduction, signal processing
PPT
matlab_tutorial.ppt
PPT
matlab_tutorial.ppt
PPT
matlab_tutorial.ppt
PPT
Introduction to Matlab Chapter One OK.ppt
PPTX
Introduction to matlab lecture 1 of 4
PDF
An Introduction to MATLAB with Worked Examples
PPTX
Matlab for diploma students(1)
PDF
Malab tutorial
PPSX
Matlab basic and image
PPT
matlab tutorial with separate function description and handson learning
PPT
Matlab Basic Tutorial
PPTX
Matlab-1.pptx
PPTX
Introduction to matlab
PDF
Introduction to MATrices LABoratory (MATLAB) as Part of Digital Signal Proces...
PPTX
Matlab - Introduction and Basics
Basics of programming in matlab for beginners
Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013
Matlab for beginners, Introduction, signal processing
matlab_tutorial.ppt
matlab_tutorial.ppt
matlab_tutorial.ppt
Introduction to Matlab Chapter One OK.ppt
Introduction to matlab lecture 1 of 4
An Introduction to MATLAB with Worked Examples
Matlab for diploma students(1)
Malab tutorial
Matlab basic and image
matlab tutorial with separate function description and handson learning
Matlab Basic Tutorial
Matlab-1.pptx
Introduction to matlab
Introduction to MATrices LABoratory (MATLAB) as Part of Digital Signal Proces...
Matlab - Introduction and Basics
Ad

More from Jairo Maldonado-Contreras (13)

PDF
49er Magazine Interview
PDF
CAMP Student of the Year
PPTX
Research info session
PPTX
Senior Design Poster
PDF
HI-POCT Conference Paper
PPTX
Northwestern University Research Poster
PPTX
Northwestern University Research PPT
PPTX
PPTX
HI-POCT Conference PowerPoint Presentation
49er Magazine Interview
CAMP Student of the Year
Research info session
Senior Design Poster
HI-POCT Conference Paper
Northwestern University Research Poster
Northwestern University Research PPT
HI-POCT Conference PowerPoint Presentation

Recently uploaded (20)

PPTX
nose tajweed for the arabic alphabets for the responsive
PDF
Tunisia's Founding Father(s) Pitch-Deck 2022.pdf
PPTX
lesson6-211001025531lesson plan ppt.pptx
PPTX
Tour Presentation Educational Activity.pptx
PPTX
The spiral of silence is a theory in communication and political science that...
PPTX
PHIL.-ASTRONOMY-AND-NAVIGATION of ..pptx
PPTX
INTERNATIONAL LABOUR ORAGNISATION PPT ON SOCIAL SCIENCE
PDF
Presentation1 [Autosaved].pdf diagnosiss
PPTX
Role and Responsibilities of Bangladesh Coast Guard Base, Mongla Challenges
PPTX
S. Anis Al Habsyi & Nada Shobah - Klasifikasi Hambatan Depresi.pptx
PPTX
_ISO_Presentation_ISO 9001 and 45001.pptx
PDF
Instagram's Product Secrets Unveiled with this PPT
PPTX
English-9-Q1-3-.pptxjkshbxnnxgchchxgxhxhx
PPTX
fundraisepro pitch deck elegant and modern
PPTX
Presentation for DGJV QMS (PQP)_12.03.2025.pptx
PPTX
Introduction to Effective Communication.pptx
PPTX
Intro to ISO 9001 2015.pptx wareness raising
PPTX
Hydrogel Based delivery Cancer Treatment
PPTX
Introduction-to-Food-Packaging-and-packaging -materials.pptx
PDF
oil_refinery_presentation_v1 sllfmfls.pdf
nose tajweed for the arabic alphabets for the responsive
Tunisia's Founding Father(s) Pitch-Deck 2022.pdf
lesson6-211001025531lesson plan ppt.pptx
Tour Presentation Educational Activity.pptx
The spiral of silence is a theory in communication and political science that...
PHIL.-ASTRONOMY-AND-NAVIGATION of ..pptx
INTERNATIONAL LABOUR ORAGNISATION PPT ON SOCIAL SCIENCE
Presentation1 [Autosaved].pdf diagnosiss
Role and Responsibilities of Bangladesh Coast Guard Base, Mongla Challenges
S. Anis Al Habsyi & Nada Shobah - Klasifikasi Hambatan Depresi.pptx
_ISO_Presentation_ISO 9001 and 45001.pptx
Instagram's Product Secrets Unveiled with this PPT
English-9-Q1-3-.pptxjkshbxnnxgchchxgxhxhx
fundraisepro pitch deck elegant and modern
Presentation for DGJV QMS (PQP)_12.03.2025.pptx
Introduction to Effective Communication.pptx
Intro to ISO 9001 2015.pptx wareness raising
Hydrogel Based delivery Cancer Treatment
Introduction-to-Food-Packaging-and-packaging -materials.pptx
oil_refinery_presentation_v1 sllfmfls.pdf

Matlab Workshop Presentation

  • 2. Overview › Introduction - What is MATLAB? › How Does It Look? › Important MATLAB Terms › Getting the MATLAB Software › Arithmetic Operations and Mathematical Functions › Conditions › Creating Arrays Matrices › Array Operators › Data Manipulation › Math Function › Plotting › If-elseif-else statements › FOR Loops › WHILE Loops › Functions › Relevance › Problem
  • 3. Introduction - What is MATLAB? MATLAB is a high-performance language for technical computing (A very big calculator). Data Analysis Serial Communication Calculations
  • 4. Command Window: Single-line code execution Editor’s Window: Edit scripts/functionsWorkspace Window: Saved variables Editor Tab: Edit scripts and functions Run: Execute scripts New: Create scripts/functions
  • 5. Getting the MATLAB Software 1. Google: CSULB Software Depot 2. Login to the Depot 3. Search: matlab 4. Add to Cart 5. Check out
  • 6. Arithmetic Operations and Mathematical Functions Symbols Description + Add expression - Negative of an expression * Multiply expression / Divide expression ^ Raising an expression to a power
  • 7. Conditions ● Is the condition true? ● True = 1 ● False = 0 Equal To Greater Than Less Than Great Than Or Equal To Not Equal To == > < >= ~= Example: 1. 5 == (225/45) 2. 2^3 > (2+7) 3. (11*9) < (108-5)
  • 8. Creating Arrays ● 3 ways to create an array in row ○ [ _ _ _ ]; ○ Start : Increment : End; ○ Linspace(Start, End, Amount of Points); ● Convert to Column ○ [ _ _ _]’; ○ transpose(array);
  • 9. Matrices ● Semicolon creates a new row ● A = [ _ _ _ ; _ _ _ ; _ _ _]; ● Ex: B = 1 2 3 0 5 0 7 0 9 ● Join matrices ○ [ B A] horizontally ○ [ B;A] vertically
  • 10. Array Operators Symbols Description + Add expression - Negative of an expression * or .* Multiply expression / or ./ Divide expression ^ or .^ Raising an expression to a power ● Period creates element by element arithmetic
  • 11. Data Manipulation ● Find data in a matrix using rows and columns ○ data = variable(row, column) ● Use find( ) to manipulate data in an array or matrix ○ [row,column] = find(data, indices returned) ○ [row,column] = find(use conditional statement) ● Use both Ex: 1. [r,c] = find(B) 2. B(2,3) 3. B(find(B))
  • 12. Math Functions ● mod(a,m) ● min(B) ● max(B) ● isempty(B) ● abs(x) ● exp(x) ● log10(x) ● sqrt(x) ● sin(x) ● sind(x) ● rand(x) ● zeros(row,col) ● ones(row,col) ● eye(row,col)
  • 13. Plotting plot(x,y,LineSpec) ● x=data to be plotted on x-axis ● y=data to be plotted on y-axis (must be same length as x) ● LineSpec=specify line/point color, shape, pattern or thickness xlabel/ylabel(‘LabelName’) ● LabelName will be displayed on respective axis title(‘TitleName’) ● TitleName will be displayed on top of graph hold on/hold off ● helps plot multiple plots in the same figure legend(‘Name1,Name2’) ● Creates a legend for line(s)
  • 14. Day Temperature (F) X Y 1 86 2 88 3 90 4 86 5 81 6 80 7 79 Ex. Plotting Weekly Temperature Data
  • 15. Ex. Plotting Weekly Temperature Data of LA and SF Day Temperature (F) Los Angeles Temperature (F) San Fransisco 1 86 60 2 88 62 3 90 65 4 86 68 5 81 66 6 80 69 7 79 70 Add: hold on/off & legend
  • 16. “if-elseif-else” Statements Example: A = ones(2,3); B = rand(3,4); If (isequal(size(A),size(B))) C = [A,B]; else disp(‘A and B are not the same size.’) C = [ ]; end if (expression) statements elseif (expression) statements else statements end
  • 17. Loops There are 2 types of loops: ● FOR loops ● WHILE loops Loops must also be closed with and END Loops can be broken using BREAK
  • 18. FOR Loops Example: x=[5,4,8,7,10] z=[]; for i=1:5 % amount of iterations z(i)=x(i)*2 %do something end % always end RESULT: z=[10,8,16,14,100]
  • 19. FOR Loops and Conditional Statements Example: x=[5,4,8,7,0,10] z=[]; for i=1:6 If x(i)==0 % can add if-else in loop Break; % stops the code else z(i)=x(i)*2 end end RESULTS: z=[10,8,16,14]
  • 20. WHILE Loops Example: x=0; while x<10 % continue until condition is false x=x+1; end RESULT: x=10
  • 21. Functions ● Function: Functions, written in scripts, are used to simplify entire scripts into one function with inputs and outputs ○ A function behave like: y = mx +b, where y=output & x=input ● In script: function [output] = name[input] do something end ● In command window out = name(in);
  • 22. Relevance For Electrical Engineers ● Computational biology ● Image and video processing ● Optimization ● Partial Differential Equations ● Signal Processing and Communications ● Statistical and Data Analysis ● Etc For Mechanical Engineering ● Statics and Dynamics ● Mechanical Vibrations ● Numerical Methods ● Finite Element Analysis