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

What's hot

MATLAB Programming
MATLAB Programming MATLAB Programming
MATLAB Programming
محمدعبد الحى
 
Matlab ppt
Matlab pptMatlab ppt
Matlab ppt
chestialtaff
 
Image Processing Using MATLAB
Image Processing Using MATLABImage Processing Using MATLAB
Image Processing Using MATLAB
Amarjeetsingh Thakur
 
Introduction to Matlab
Introduction to MatlabIntroduction to Matlab
Introduction to Matlab
aman gupta
 
Introduction to MATLAB
Introduction to MATLABIntroduction to MATLAB
Introduction to MATLAB
Ravikiran A
 
Matlab Tutorial.ppt
Matlab Tutorial.pptMatlab Tutorial.ppt
Matlab Tutorial.ppt
RaviMuthamala1
 
MATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulink
MATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulinkMATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulink
MATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulink
reddyprasad reddyvari
 
Matlab Graphics Tutorial
Matlab Graphics TutorialMatlab Graphics Tutorial
Matlab Graphics Tutorial
Cheng-An Yang
 
Matlab ploting
Matlab plotingMatlab ploting
Matlab ploting
Ameen San
 
Advanced MATLAB Tutorial for Engineers & Scientists
Advanced MATLAB Tutorial for Engineers & ScientistsAdvanced MATLAB Tutorial for Engineers & Scientists
Advanced MATLAB Tutorial for Engineers & Scientists
Ray Phan
 
Basic matlab and matrix
Basic matlab and matrixBasic matlab and matrix
Basic matlab and matrix
Saidur Rahman
 
Digital Electronics Question Bank
Digital Electronics Question BankDigital Electronics Question Bank
Digital Electronics Question Bank
Mathankumar S
 
Introduction to matlab lecture 1 of 4
Introduction to matlab lecture 1 of 4Introduction to matlab lecture 1 of 4
Introduction to matlab lecture 1 of 4
Randa Elanwar
 
Matlab Introduction
Matlab IntroductionMatlab Introduction
Matlab Introduction
Daniel Moore
 
Matlab basic and image
Matlab basic and imageMatlab basic and image
Matlab basic and image
Divyanshu Rasauria
 
Brief Introduction to Matlab
Brief  Introduction to MatlabBrief  Introduction to Matlab
Brief Introduction to Matlab
Tariq kanher
 
Matlab for beginners, Introduction, signal processing
Matlab for beginners, Introduction, signal processingMatlab for beginners, Introduction, signal processing
Matlab for beginners, Introduction, signal processing
Dr. Manjunatha. P
 
Matlab practical and lab session
Matlab practical and lab sessionMatlab practical and lab session
Matlab practical and lab sessionDr. Krishna Mohbey
 
Matlab introduction lecture 1
Matlab introduction lecture 1Matlab introduction lecture 1
Matlab introduction lecture 1
Mohamed Awni
 

What's hot (20)

MATLAB Programming
MATLAB Programming MATLAB Programming
MATLAB Programming
 
Matlab ppt
Matlab pptMatlab ppt
Matlab ppt
 
Image Processing Using MATLAB
Image Processing Using MATLABImage Processing Using MATLAB
Image Processing Using MATLAB
 
Introduction to Matlab
Introduction to MatlabIntroduction to Matlab
Introduction to Matlab
 
Introduction to MATLAB
Introduction to MATLABIntroduction to MATLAB
Introduction to MATLAB
 
Matlab Tutorial.ppt
Matlab Tutorial.pptMatlab Tutorial.ppt
Matlab Tutorial.ppt
 
MATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulink
MATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulinkMATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulink
MATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulink
 
Matlab Graphics Tutorial
Matlab Graphics TutorialMatlab Graphics Tutorial
Matlab Graphics Tutorial
 
Matlab ploting
Matlab plotingMatlab ploting
Matlab ploting
 
Advanced MATLAB Tutorial for Engineers & Scientists
Advanced MATLAB Tutorial for Engineers & ScientistsAdvanced MATLAB Tutorial for Engineers & Scientists
Advanced MATLAB Tutorial for Engineers & Scientists
 
Basic matlab and matrix
Basic matlab and matrixBasic matlab and matrix
Basic matlab and matrix
 
Digital Electronics Question Bank
Digital Electronics Question BankDigital Electronics Question Bank
Digital Electronics Question Bank
 
Introduction to matlab lecture 1 of 4
Introduction to matlab lecture 1 of 4Introduction to matlab lecture 1 of 4
Introduction to matlab lecture 1 of 4
 
Matlab Introduction
Matlab IntroductionMatlab Introduction
Matlab Introduction
 
Learn Matlab
Learn MatlabLearn Matlab
Learn Matlab
 
Matlab basic and image
Matlab basic and imageMatlab basic and image
Matlab basic and image
 
Brief Introduction to Matlab
Brief  Introduction to MatlabBrief  Introduction to Matlab
Brief Introduction to Matlab
 
Matlab for beginners, Introduction, signal processing
Matlab for beginners, Introduction, signal processingMatlab for beginners, Introduction, signal processing
Matlab for beginners, Introduction, signal processing
 
Matlab practical and lab session
Matlab practical and lab sessionMatlab practical and lab session
Matlab practical and lab session
 
Matlab introduction lecture 1
Matlab introduction lecture 1Matlab introduction lecture 1
Matlab introduction lecture 1
 

Similar to Matlab Workshop Presentation

presentation.pptx
presentation.pptxpresentation.pptx
presentation.pptx
raghav415187
 
INTRODUCTION TO MATLAB presentation.pptx
INTRODUCTION TO MATLAB presentation.pptxINTRODUCTION TO MATLAB presentation.pptx
INTRODUCTION TO MATLAB presentation.pptx
Devaraj Chilakala
 
MATLAB-Introd.ppt
MATLAB-Introd.pptMATLAB-Introd.ppt
MATLAB-Introd.ppt
kebeAman
 
MatlabIntro (1).ppt
MatlabIntro (1).pptMatlabIntro (1).ppt
MatlabIntro (1).ppt
AkashSingh728626
 
Basic concept of MATLAB.ppt
Basic concept of MATLAB.pptBasic concept of MATLAB.ppt
Basic concept of MATLAB.ppt
aliraza2732
 
An Introduction to MATLAB for beginners
An Introduction to MATLAB for beginnersAn Introduction to MATLAB for beginners
An Introduction to MATLAB for beginners
Murshida ck
 
Matlab 1
Matlab 1Matlab 1
Matlab 1asguna
 
Matlab ch1 intro
Matlab ch1 introMatlab ch1 intro
Matlab ch1 intro
Ragu Nathan
 
Java 8
Java 8Java 8
Java 8
vilniusjug
 
Importance of matlab
Importance of matlabImportance of matlab
Importance of matlab
krajeshk1980
 
Matlab Basic Tutorial
Matlab Basic TutorialMatlab Basic Tutorial
Matlab Basic Tutorial
Muhammad Rizwan
 
Introduction to Matlab.ppt
Introduction to Matlab.pptIntroduction to Matlab.ppt
Introduction to Matlab.ppt
Ravibabu Kancharla
 
Lines and planes in space
Lines and planes in spaceLines and planes in space
Lines and planes in space
Faizan Shabbir
 
Calculator-Techniques for engineering.pptx
Calculator-Techniques for engineering.pptxCalculator-Techniques for engineering.pptx
Calculator-Techniques for engineering.pptx
Soleil50
 
SAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docx
SAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docxSAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docx
SAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docx
agnesdcarey33086
 
Mbd2
Mbd2Mbd2
Unit-1 Basic Concept of Algorithm.pptx
Unit-1 Basic Concept of Algorithm.pptxUnit-1 Basic Concept of Algorithm.pptx
Unit-1 Basic Concept of Algorithm.pptx
ssuser01e301
 
Matlab introduction
Matlab introductionMatlab introduction
Matlab introduction
Vikash Jakhar
 

Similar to Matlab Workshop Presentation (20)

presentation.pptx
presentation.pptxpresentation.pptx
presentation.pptx
 
INTRODUCTION TO MATLAB presentation.pptx
INTRODUCTION TO MATLAB presentation.pptxINTRODUCTION TO MATLAB presentation.pptx
INTRODUCTION TO MATLAB presentation.pptx
 
MATLAB-Introd.ppt
MATLAB-Introd.pptMATLAB-Introd.ppt
MATLAB-Introd.ppt
 
MatlabIntro (1).ppt
MatlabIntro (1).pptMatlabIntro (1).ppt
MatlabIntro (1).ppt
 
Matlab1
Matlab1Matlab1
Matlab1
 
Basic concept of MATLAB.ppt
Basic concept of MATLAB.pptBasic concept of MATLAB.ppt
Basic concept of MATLAB.ppt
 
An Introduction to MATLAB for beginners
An Introduction to MATLAB for beginnersAn Introduction to MATLAB for beginners
An Introduction to MATLAB for beginners
 
Matlab 1
Matlab 1Matlab 1
Matlab 1
 
Matlab ch1 intro
Matlab ch1 introMatlab ch1 intro
Matlab ch1 intro
 
Java 8
Java 8Java 8
Java 8
 
Importance of matlab
Importance of matlabImportance of matlab
Importance of matlab
 
Matlab Basic Tutorial
Matlab Basic TutorialMatlab Basic Tutorial
Matlab Basic Tutorial
 
Introduction to Matlab.ppt
Introduction to Matlab.pptIntroduction to Matlab.ppt
Introduction to Matlab.ppt
 
Lines and planes in space
Lines and planes in spaceLines and planes in space
Lines and planes in space
 
Lec2
Lec2Lec2
Lec2
 
Calculator-Techniques for engineering.pptx
Calculator-Techniques for engineering.pptxCalculator-Techniques for engineering.pptx
Calculator-Techniques for engineering.pptx
 
SAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docx
SAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docxSAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docx
SAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docx
 
Mbd2
Mbd2Mbd2
Mbd2
 
Unit-1 Basic Concept of Algorithm.pptx
Unit-1 Basic Concept of Algorithm.pptxUnit-1 Basic Concept of Algorithm.pptx
Unit-1 Basic Concept of Algorithm.pptx
 
Matlab introduction
Matlab introductionMatlab introduction
Matlab introduction
 

More from Jairo Maldonado-Contreras

49er Magazine Interview
49er Magazine Interview49er Magazine Interview
49er Magazine Interview
Jairo Maldonado-Contreras
 
CAMP Student of the Year
CAMP Student of the YearCAMP Student of the Year
CAMP Student of the Year
Jairo Maldonado-Contreras
 
Research info session
Research info sessionResearch info session
Research info session
Jairo Maldonado-Contreras
 
MIT Poster
MIT PosterMIT Poster
EMBC Paper
EMBC PaperEMBC Paper
EMBC PPT
EMBC PPTEMBC PPT
Senior Design Poster
Senior Design PosterSenior Design Poster
Senior Design Poster
Jairo Maldonado-Contreras
 
HI-POCT Conference Paper
HI-POCT Conference PaperHI-POCT Conference Paper
HI-POCT Conference Paper
Jairo Maldonado-Contreras
 
Northwestern University Research Poster
Northwestern University Research PosterNorthwestern University Research Poster
Northwestern University Research Poster
Jairo Maldonado-Contreras
 
Northwestern University Research PPT
Northwestern University Research PPTNorthwestern University Research PPT
Northwestern University Research PPT
Jairo Maldonado-Contreras
 
EMBC Poster
EMBC PosterEMBC Poster
HI-POCT Conference PowerPoint Presentation
HI-POCT Conference PowerPoint PresentationHI-POCT Conference PowerPoint Presentation
HI-POCT Conference PowerPoint Presentation
Jairo Maldonado-Contreras
 

More from Jairo Maldonado-Contreras (13)

CV
CVCV
CV
 
49er Magazine Interview
49er Magazine Interview49er Magazine Interview
49er Magazine Interview
 
CAMP Student of the Year
CAMP Student of the YearCAMP Student of the Year
CAMP Student of the Year
 
Research info session
Research info sessionResearch info session
Research info session
 
MIT Poster
MIT PosterMIT Poster
MIT Poster
 
EMBC Paper
EMBC PaperEMBC Paper
EMBC Paper
 
EMBC PPT
EMBC PPTEMBC PPT
EMBC PPT
 
Senior Design Poster
Senior Design PosterSenior Design Poster
Senior Design Poster
 
HI-POCT Conference Paper
HI-POCT Conference PaperHI-POCT Conference Paper
HI-POCT Conference Paper
 
Northwestern University Research Poster
Northwestern University Research PosterNorthwestern University Research Poster
Northwestern University Research Poster
 
Northwestern University Research PPT
Northwestern University Research PPTNorthwestern University Research PPT
Northwestern University Research PPT
 
EMBC Poster
EMBC PosterEMBC Poster
EMBC Poster
 
HI-POCT Conference PowerPoint Presentation
HI-POCT Conference PowerPoint PresentationHI-POCT Conference PowerPoint Presentation
HI-POCT Conference PowerPoint Presentation
 

Recently uploaded

Media as a Mind Controlling Strategy In Old and Modern Era
Media as a Mind Controlling Strategy In Old and Modern EraMedia as a Mind Controlling Strategy In Old and Modern Era
Media as a Mind Controlling Strategy In Old and Modern Era
faizulhassanfaiz1670
 
Bonzo subscription_hjjjjjjjj5hhhhhhh_2024.pdf
Bonzo subscription_hjjjjjjjj5hhhhhhh_2024.pdfBonzo subscription_hjjjjjjjj5hhhhhhh_2024.pdf
Bonzo subscription_hjjjjjjjj5hhhhhhh_2024.pdf
khadija278284
 
Obesity causes and management and associated medical conditions
Obesity causes and management and associated medical conditionsObesity causes and management and associated medical conditions
Obesity causes and management and associated medical conditions
Faculty of Medicine And Health Sciences
 
Sharpen existing tools or get a new toolbox? Contemporary cluster initiatives...
Sharpen existing tools or get a new toolbox? Contemporary cluster initiatives...Sharpen existing tools or get a new toolbox? Contemporary cluster initiatives...
Sharpen existing tools or get a new toolbox? Contemporary cluster initiatives...
Orkestra
 
International Workshop on Artificial Intelligence in Software Testing
International Workshop on Artificial Intelligence in Software TestingInternational Workshop on Artificial Intelligence in Software Testing
International Workshop on Artificial Intelligence in Software Testing
Sebastiano Panichella
 
Gregory Harris' Civics Presentation.pptx
Gregory Harris' Civics Presentation.pptxGregory Harris' Civics Presentation.pptx
Gregory Harris' Civics Presentation.pptx
gharris9
 
0x01 - Newton's Third Law: Static vs. Dynamic Abusers
0x01 - Newton's Third Law:  Static vs. Dynamic Abusers0x01 - Newton's Third Law:  Static vs. Dynamic Abusers
0x01 - Newton's Third Law: Static vs. Dynamic Abusers
OWASP Beja
 
Eureka, I found it! - Special Libraries Association 2021 Presentation
Eureka, I found it! - Special Libraries Association 2021 PresentationEureka, I found it! - Special Libraries Association 2021 Presentation
Eureka, I found it! - Special Libraries Association 2021 Presentation
Access Innovations, Inc.
 
María Carolina Martínez - eCommerce Day Colombia 2024
María Carolina Martínez - eCommerce Day Colombia 2024María Carolina Martínez - eCommerce Day Colombia 2024
María Carolina Martínez - eCommerce Day Colombia 2024
eCommerce Institute
 
Supercharge your AI - SSP Industry Breakout Session 2024-v2_1.pdf
Supercharge your AI - SSP Industry Breakout Session 2024-v2_1.pdfSupercharge your AI - SSP Industry Breakout Session 2024-v2_1.pdf
Supercharge your AI - SSP Industry Breakout Session 2024-v2_1.pdf
Access Innovations, Inc.
 
Competition and Regulation in Professional Services – KLEINER – June 2024 OEC...
Competition and Regulation in Professional Services – KLEINER – June 2024 OEC...Competition and Regulation in Professional Services – KLEINER – June 2024 OEC...
Competition and Regulation in Professional Services – KLEINER – June 2024 OEC...
OECD Directorate for Financial and Enterprise Affairs
 
Bitcoin Lightning wallet and tic-tac-toe game XOXO
Bitcoin Lightning wallet and tic-tac-toe game XOXOBitcoin Lightning wallet and tic-tac-toe game XOXO
Bitcoin Lightning wallet and tic-tac-toe game XOXO
Matjaž Lipuš
 
Announcement of 18th IEEE International Conference on Software Testing, Verif...
Announcement of 18th IEEE International Conference on Software Testing, Verif...Announcement of 18th IEEE International Conference on Software Testing, Verif...
Announcement of 18th IEEE International Conference on Software Testing, Verif...
Sebastiano Panichella
 
somanykidsbutsofewfathers-140705000023-phpapp02.pptx
somanykidsbutsofewfathers-140705000023-phpapp02.pptxsomanykidsbutsofewfathers-140705000023-phpapp02.pptx
somanykidsbutsofewfathers-140705000023-phpapp02.pptx
Howard Spence
 
Getting started with Amazon Bedrock Studio and Control Tower
Getting started with Amazon Bedrock Studio and Control TowerGetting started with Amazon Bedrock Studio and Control Tower
Getting started with Amazon Bedrock Studio and Control Tower
Vladimir Samoylov
 
Doctoral Symposium at the 17th IEEE International Conference on Software Test...
Doctoral Symposium at the 17th IEEE International Conference on Software Test...Doctoral Symposium at the 17th IEEE International Conference on Software Test...
Doctoral Symposium at the 17th IEEE International Conference on Software Test...
Sebastiano Panichella
 
Acorn Recovery: Restore IT infra within minutes
Acorn Recovery: Restore IT infra within minutesAcorn Recovery: Restore IT infra within minutes
Acorn Recovery: Restore IT infra within minutes
IP ServerOne
 

Recently uploaded (17)

Media as a Mind Controlling Strategy In Old and Modern Era
Media as a Mind Controlling Strategy In Old and Modern EraMedia as a Mind Controlling Strategy In Old and Modern Era
Media as a Mind Controlling Strategy In Old and Modern Era
 
Bonzo subscription_hjjjjjjjj5hhhhhhh_2024.pdf
Bonzo subscription_hjjjjjjjj5hhhhhhh_2024.pdfBonzo subscription_hjjjjjjjj5hhhhhhh_2024.pdf
Bonzo subscription_hjjjjjjjj5hhhhhhh_2024.pdf
 
Obesity causes and management and associated medical conditions
Obesity causes and management and associated medical conditionsObesity causes and management and associated medical conditions
Obesity causes and management and associated medical conditions
 
Sharpen existing tools or get a new toolbox? Contemporary cluster initiatives...
Sharpen existing tools or get a new toolbox? Contemporary cluster initiatives...Sharpen existing tools or get a new toolbox? Contemporary cluster initiatives...
Sharpen existing tools or get a new toolbox? Contemporary cluster initiatives...
 
International Workshop on Artificial Intelligence in Software Testing
International Workshop on Artificial Intelligence in Software TestingInternational Workshop on Artificial Intelligence in Software Testing
International Workshop on Artificial Intelligence in Software Testing
 
Gregory Harris' Civics Presentation.pptx
Gregory Harris' Civics Presentation.pptxGregory Harris' Civics Presentation.pptx
Gregory Harris' Civics Presentation.pptx
 
0x01 - Newton's Third Law: Static vs. Dynamic Abusers
0x01 - Newton's Third Law:  Static vs. Dynamic Abusers0x01 - Newton's Third Law:  Static vs. Dynamic Abusers
0x01 - Newton's Third Law: Static vs. Dynamic Abusers
 
Eureka, I found it! - Special Libraries Association 2021 Presentation
Eureka, I found it! - Special Libraries Association 2021 PresentationEureka, I found it! - Special Libraries Association 2021 Presentation
Eureka, I found it! - Special Libraries Association 2021 Presentation
 
María Carolina Martínez - eCommerce Day Colombia 2024
María Carolina Martínez - eCommerce Day Colombia 2024María Carolina Martínez - eCommerce Day Colombia 2024
María Carolina Martínez - eCommerce Day Colombia 2024
 
Supercharge your AI - SSP Industry Breakout Session 2024-v2_1.pdf
Supercharge your AI - SSP Industry Breakout Session 2024-v2_1.pdfSupercharge your AI - SSP Industry Breakout Session 2024-v2_1.pdf
Supercharge your AI - SSP Industry Breakout Session 2024-v2_1.pdf
 
Competition and Regulation in Professional Services – KLEINER – June 2024 OEC...
Competition and Regulation in Professional Services – KLEINER – June 2024 OEC...Competition and Regulation in Professional Services – KLEINER – June 2024 OEC...
Competition and Regulation in Professional Services – KLEINER – June 2024 OEC...
 
Bitcoin Lightning wallet and tic-tac-toe game XOXO
Bitcoin Lightning wallet and tic-tac-toe game XOXOBitcoin Lightning wallet and tic-tac-toe game XOXO
Bitcoin Lightning wallet and tic-tac-toe game XOXO
 
Announcement of 18th IEEE International Conference on Software Testing, Verif...
Announcement of 18th IEEE International Conference on Software Testing, Verif...Announcement of 18th IEEE International Conference on Software Testing, Verif...
Announcement of 18th IEEE International Conference on Software Testing, Verif...
 
somanykidsbutsofewfathers-140705000023-phpapp02.pptx
somanykidsbutsofewfathers-140705000023-phpapp02.pptxsomanykidsbutsofewfathers-140705000023-phpapp02.pptx
somanykidsbutsofewfathers-140705000023-phpapp02.pptx
 
Getting started with Amazon Bedrock Studio and Control Tower
Getting started with Amazon Bedrock Studio and Control TowerGetting started with Amazon Bedrock Studio and Control Tower
Getting started with Amazon Bedrock Studio and Control Tower
 
Doctoral Symposium at the 17th IEEE International Conference on Software Test...
Doctoral Symposium at the 17th IEEE International Conference on Software Test...Doctoral Symposium at the 17th IEEE International Conference on Software Test...
Doctoral Symposium at the 17th IEEE International Conference on Software Test...
 
Acorn Recovery: Restore IT infra within minutes
Acorn Recovery: Restore IT infra within minutesAcorn Recovery: Restore IT infra within minutes
Acorn Recovery: Restore IT infra within minutes
 

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