SlideShare a Scribd company logo
Signals and Systems Lab Course

Grading Criteria
Attendance……….10%
Lab Tasks…………..30%
Project………………20%
Lab exam..………...20%

Viva…………………..20%

CECOS College of Engineering and IT

March – July 2012
Accessing lab server
 To download manuals and software from lab server
 Goto : start >> Run >> write dsp-server

CECOS College of Engineering and IT

March – July 2012
Lab No.01

Getting Familiar with MATLAB

Designed by : Dawar Awan
dawar@cecos.edu.pk
CECOS College of Engineering and IT

March – July 2012
MATLAB
 Software by MathWorks
 Matrix Laboratory
 Every thing is treated as matrix
 Integrates computation, visualization, and programming
in an easy-to-use environment
 A high-level technical computing language and interactive
environment for algorithm development, data
visualization, data analysis, and numeric computation
CECOS College of Engineering and IT

March – July 2012
MATLAB
 add-on toolboxes provide application specific commands
 The power lye in rich libraries and toolboxes for almost
every field of engineering

CECOS College of Engineering and IT

March – July 2012
Starting/Ending MATLAB
 Double click MATLAB icon to launch MATLAB
 A command window will appear with the prompt
>>
you are now in MATLAB
 To quit from MATLAB write “exit” or “quit” on MATLAB
prompt and press enter

CECOS College of Engineering and IT

March – July 2012
MATLAB Interface

Current directory

Command window
Workspace

Command history

CECOS College of Engineering and IT

March – July 2012
Variables
 User defined variables




CECOS College of Engineering and IT

(“^” , is used for power)

March – July 2012
Variables
 Suppressing output

(use semi colon at the end of instruction)

 Value of variable

CECOS College of Engineering and IT

March – July 2012
Variables
 Knowing your active variables
>> who
Your variables are:
ans x y
 To remove a variable, write clear variablename

>> clear x
 To remove all the variables from workspace, use clear
>> clear

CECOS College of Engineering and IT

March – July 2012
Variable arithmetic

2+3*4^2 <== exponent has the highest precedence
==> 2 + 3*16 <== then multiplication operator
==> 2 + 48 <== then addition operator
==> 50

CECOS College of Engineering and IT

March – July 2012
Predefined trigonometric functions
Function
Meaning
Example
===========================================================
sin
sine
sin(pi) = 0.0
cos
cosine
cos(pi) = -1.0
tan
tangent
tan(pi/4) = 1.0
asin
arcsine
asin(1)= 1.5708
acos
arccosine
acos(1)= 0.0
atan
arctangent
atan(1)= 0.7854
exp
exponential
exp(1.0) = 2.7183
log
natural logarithm
log(2.7183) = 1.0
log10
logarithm base 10
log10(100.0) = 2.0
===========================================================
The arguments of trigonometric functions are given in radians

CECOS College of Engineering and IT

March – July 2012
Practice
 Verify that
sin2(x)+ cos2(x) = 1

 For arbitrary x, the MATLAB code will be:

CECOS College of Engineering and IT

March – July 2012
MATLAB Help
 www.mathworks.com
 >> help
 >> help <command name>

CECOS College of Engineering and IT

March – July 2012
Tasks
1. Write a MATLAB code to verify the formula
a2-b2 = (a+b)(a-b)

2. What is the function of the commands, ceil and floor ? Use
MATLAB help to learn these commands and then apply them
to a constant of 4.5
3. Use MATLAB to find the area of a circle whose radius is 4

CECOS College of Engineering and IT

March – July 2012

More Related Content

What's hot

Xi practical file
Xi practical fileXi practical file
Xi practical file
dipanshupatidar3
 
Convolution using Scilab
Convolution using ScilabConvolution using Scilab
Convolution using Scilab
sachin achari
 
Linear regression model
Linear regression modelLinear regression model
Linear regression model
SatyamDeshPandey
 
Function overloading in c++
Function overloading in c++Function overloading in c++
Function overloading in c++
BalajiGovindan5
 
Cis 355 i lab 3 of 6
Cis 355 i lab 3 of 6Cis 355 i lab 3 of 6
Cis 355 i lab 3 of 6
helpido9
 
Introduction to simulink (1)
Introduction to simulink (1)Introduction to simulink (1)
Introduction to simulink (1)
Memo Love
 
Tte 451 operations research fall 2021 part 1
Tte 451  operations research   fall 2021   part 1Tte 451  operations research   fall 2021   part 1
Tte 451 operations research fall 2021 part 1
Wael ElDessouki
 
MATLAB/SIMULINK for engineering applications: day 3
MATLAB/SIMULINK for engineering applications: day 3MATLAB/SIMULINK for engineering applications: day 3
MATLAB/SIMULINK for engineering applications: day 3
reddyprasad reddyvari
 
R programmingmilano
R programmingmilanoR programmingmilano
R programmingmilano
Ismail Seyrik
 
Binary operator overloading
Binary operator overloadingBinary operator overloading
Binary operator overloading
BalajiGovindan5
 
Profiling Java Programs for Parallelism
Profiling Java Programs for ParallelismProfiling Java Programs for Parallelism
Profiling Java Programs for Parallelism
Dmitry Anisimov
 

What's hot (11)

Xi practical file
Xi practical fileXi practical file
Xi practical file
 
Convolution using Scilab
Convolution using ScilabConvolution using Scilab
Convolution using Scilab
 
Linear regression model
Linear regression modelLinear regression model
Linear regression model
 
Function overloading in c++
Function overloading in c++Function overloading in c++
Function overloading in c++
 
Cis 355 i lab 3 of 6
Cis 355 i lab 3 of 6Cis 355 i lab 3 of 6
Cis 355 i lab 3 of 6
 
Introduction to simulink (1)
Introduction to simulink (1)Introduction to simulink (1)
Introduction to simulink (1)
 
Tte 451 operations research fall 2021 part 1
Tte 451  operations research   fall 2021   part 1Tte 451  operations research   fall 2021   part 1
Tte 451 operations research fall 2021 part 1
 
MATLAB/SIMULINK for engineering applications: day 3
MATLAB/SIMULINK for engineering applications: day 3MATLAB/SIMULINK for engineering applications: day 3
MATLAB/SIMULINK for engineering applications: day 3
 
R programmingmilano
R programmingmilanoR programmingmilano
R programmingmilano
 
Binary operator overloading
Binary operator overloadingBinary operator overloading
Binary operator overloading
 
Profiling Java Programs for Parallelism
Profiling Java Programs for ParallelismProfiling Java Programs for Parallelism
Profiling Java Programs for Parallelism
 

Viewers also liked

Lab no.08
Lab no.08Lab no.08
matab no4
matab no4matab no4
matab no9
matab no9matab no9
communication system Chapter 6
communication system Chapter 6communication system Chapter 6
communication system Chapter 6
moeen khan afridi
 
communication system ch1
communication system ch1communication system ch1
communication system ch1
moeen khan afridi
 
Lab no.07
Lab no.07Lab no.07
communication system Chapter 5
communication system Chapter 5communication system Chapter 5
communication system Chapter 5
moeen khan afridi
 
communication system Chapter 3
communication system Chapter 3communication system Chapter 3
communication system Chapter 3
moeen khan afridi
 
communication system Chapter 4
communication system Chapter 4communication system Chapter 4
communication system Chapter 4
moeen khan afridi
 
communication system Chapter 2
communication system Chapter 2communication system Chapter 2
communication system Chapter 2
moeen khan afridi
 

Viewers also liked (10)

Lab no.08
Lab no.08Lab no.08
Lab no.08
 
matab no4
matab no4matab no4
matab no4
 
matab no9
matab no9matab no9
matab no9
 
communication system Chapter 6
communication system Chapter 6communication system Chapter 6
communication system Chapter 6
 
communication system ch1
communication system ch1communication system ch1
communication system ch1
 
Lab no.07
Lab no.07Lab no.07
Lab no.07
 
communication system Chapter 5
communication system Chapter 5communication system Chapter 5
communication system Chapter 5
 
communication system Chapter 3
communication system Chapter 3communication system Chapter 3
communication system Chapter 3
 
communication system Chapter 4
communication system Chapter 4communication system Chapter 4
communication system Chapter 4
 
communication system Chapter 2
communication system Chapter 2communication system Chapter 2
communication system Chapter 2
 

Similar to matlab no1

Introduction to MATLAB
Introduction to MATLABIntroduction to MATLAB
Introduction to MATLAB
Ravikiran A
 
Implementasi Pemodelan Sistem Ke TeeChart 2
Implementasi Pemodelan Sistem Ke TeeChart  2Implementasi Pemodelan Sistem Ke TeeChart  2
Implementasi Pemodelan Sistem Ke TeeChart 2
Lusiana Diyan
 
Linear programming assignment help
Linear programming assignment helpLinear programming assignment help
Linear programming assignment help
Statistics Help Desk
 
MatlabSimulinkTutorial.ppt
MatlabSimulinkTutorial.pptMatlabSimulinkTutorial.ppt
MatlabSimulinkTutorial.ppt
jeronimored
 
Matlab_Simulink_Tutorial.ppt
Matlab_Simulink_Tutorial.pptMatlab_Simulink_Tutorial.ppt
Matlab_Simulink_Tutorial.ppt
DrBashirMSaad
 
Chapter 16-spreadsheet1 questions and answer
Chapter 16-spreadsheet1  questions and answerChapter 16-spreadsheet1  questions and answer
Chapter 16-spreadsheet1 questions and answer
RaajTech
 
Matlab_Simulink_Tutorial.ppt
Matlab_Simulink_Tutorial.pptMatlab_Simulink_Tutorial.ppt
Matlab_Simulink_Tutorial.ppt
PrasenjitDey49
 
Cse 7 softcomputing lab
Cse 7 softcomputing labCse 7 softcomputing lab
Cse 7 softcomputing lab
Vivek Kumar Sinha
 
Designing Architecture-aware Library using Boost.Proto
Designing Architecture-aware Library using Boost.ProtoDesigning Architecture-aware Library using Boost.Proto
Designing Architecture-aware Library using Boost.Proto
Joel Falcou
 
python.ppt
python.pptpython.ppt
python.ppt
ssuser696419
 
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
 
python(1).ppt
python(1).pptpython(1).ppt
python(1).ppt
hamm14
 
AtlasCamp 2015: Confluence making your life EASier
AtlasCamp 2015: Confluence making your life EASierAtlasCamp 2015: Confluence making your life EASier
AtlasCamp 2015: Confluence making your life EASier
Atlassian
 
Python basics
Python basicsPython basics
Python basics
PrafullaKamble3
 
syllbca191011160419.pdf
syllbca191011160419.pdfsyllbca191011160419.pdf
syllbca191011160419.pdf
MohammadAsim91
 
Implementasi Pemodelan Sistem Ke TeeChart
Implementasi Pemodelan Sistem Ke TeeChartImplementasi Pemodelan Sistem Ke TeeChart
Implementasi Pemodelan Sistem Ke TeeChart
Lusiana Diyan
 
Matlab-1.pptx
Matlab-1.pptxMatlab-1.pptx
Matlab-1.pptx
aboma2hawi
 
python.ppt
python.pptpython.ppt
python.ppt
NikhilSoni177492
 
SQL Functions and Operators
SQL Functions and OperatorsSQL Functions and Operators
SQL Functions and Operators
Mohan Kumar.R
 
Cocomomodel
CocomomodelCocomomodel

Similar to matlab no1 (20)

Introduction to MATLAB
Introduction to MATLABIntroduction to MATLAB
Introduction to MATLAB
 
Implementasi Pemodelan Sistem Ke TeeChart 2
Implementasi Pemodelan Sistem Ke TeeChart  2Implementasi Pemodelan Sistem Ke TeeChart  2
Implementasi Pemodelan Sistem Ke TeeChart 2
 
Linear programming assignment help
Linear programming assignment helpLinear programming assignment help
Linear programming assignment help
 
MatlabSimulinkTutorial.ppt
MatlabSimulinkTutorial.pptMatlabSimulinkTutorial.ppt
MatlabSimulinkTutorial.ppt
 
Matlab_Simulink_Tutorial.ppt
Matlab_Simulink_Tutorial.pptMatlab_Simulink_Tutorial.ppt
Matlab_Simulink_Tutorial.ppt
 
Chapter 16-spreadsheet1 questions and answer
Chapter 16-spreadsheet1  questions and answerChapter 16-spreadsheet1  questions and answer
Chapter 16-spreadsheet1 questions and answer
 
Matlab_Simulink_Tutorial.ppt
Matlab_Simulink_Tutorial.pptMatlab_Simulink_Tutorial.ppt
Matlab_Simulink_Tutorial.ppt
 
Cse 7 softcomputing lab
Cse 7 softcomputing labCse 7 softcomputing lab
Cse 7 softcomputing lab
 
Designing Architecture-aware Library using Boost.Proto
Designing Architecture-aware Library using Boost.ProtoDesigning Architecture-aware Library using Boost.Proto
Designing Architecture-aware Library using Boost.Proto
 
python.ppt
python.pptpython.ppt
python.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
 
python(1).ppt
python(1).pptpython(1).ppt
python(1).ppt
 
AtlasCamp 2015: Confluence making your life EASier
AtlasCamp 2015: Confluence making your life EASierAtlasCamp 2015: Confluence making your life EASier
AtlasCamp 2015: Confluence making your life EASier
 
Python basics
Python basicsPython basics
Python basics
 
syllbca191011160419.pdf
syllbca191011160419.pdfsyllbca191011160419.pdf
syllbca191011160419.pdf
 
Implementasi Pemodelan Sistem Ke TeeChart
Implementasi Pemodelan Sistem Ke TeeChartImplementasi Pemodelan Sistem Ke TeeChart
Implementasi Pemodelan Sistem Ke TeeChart
 
Matlab-1.pptx
Matlab-1.pptxMatlab-1.pptx
Matlab-1.pptx
 
python.ppt
python.pptpython.ppt
python.ppt
 
SQL Functions and Operators
SQL Functions and OperatorsSQL Functions and Operators
SQL Functions and Operators
 
Cocomomodel
CocomomodelCocomomodel
Cocomomodel
 

Recently uploaded

C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
mulvey2
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Dr. Vinod Kumar Kanvaria
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
Celine George
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
Priyankaranawat4
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
chanes7
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
Israel Genealogy Research Association
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
Celine George
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
tarandeep35
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Akanksha trivedi rama nursing college kanpur.
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
adhitya5119
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
AyyanKhan40
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
Celine George
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
Colégio Santa Teresinha
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
NgcHiNguyn25
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
Dr. Mulla Adam Ali
 

Recently uploaded (20)

C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
 

matlab no1

  • 1. Signals and Systems Lab Course Grading Criteria Attendance……….10% Lab Tasks…………..30% Project………………20% Lab exam..………...20% Viva…………………..20% CECOS College of Engineering and IT March – July 2012
  • 2. Accessing lab server  To download manuals and software from lab server  Goto : start >> Run >> write dsp-server CECOS College of Engineering and IT March – July 2012
  • 3. Lab No.01 Getting Familiar with MATLAB Designed by : Dawar Awan dawar@cecos.edu.pk CECOS College of Engineering and IT March – July 2012
  • 4. MATLAB  Software by MathWorks  Matrix Laboratory  Every thing is treated as matrix  Integrates computation, visualization, and programming in an easy-to-use environment  A high-level technical computing language and interactive environment for algorithm development, data visualization, data analysis, and numeric computation CECOS College of Engineering and IT March – July 2012
  • 5. MATLAB  add-on toolboxes provide application specific commands  The power lye in rich libraries and toolboxes for almost every field of engineering CECOS College of Engineering and IT March – July 2012
  • 6. Starting/Ending MATLAB  Double click MATLAB icon to launch MATLAB  A command window will appear with the prompt >> you are now in MATLAB  To quit from MATLAB write “exit” or “quit” on MATLAB prompt and press enter CECOS College of Engineering and IT March – July 2012
  • 7. MATLAB Interface Current directory Command window Workspace Command history CECOS College of Engineering and IT March – July 2012
  • 8. Variables  User defined variables   CECOS College of Engineering and IT (“^” , is used for power) March – July 2012
  • 9. Variables  Suppressing output (use semi colon at the end of instruction)  Value of variable CECOS College of Engineering and IT March – July 2012
  • 10. Variables  Knowing your active variables >> who Your variables are: ans x y  To remove a variable, write clear variablename >> clear x  To remove all the variables from workspace, use clear >> clear CECOS College of Engineering and IT March – July 2012
  • 11. Variable arithmetic 2+3*4^2 <== exponent has the highest precedence ==> 2 + 3*16 <== then multiplication operator ==> 2 + 48 <== then addition operator ==> 50 CECOS College of Engineering and IT March – July 2012
  • 12. Predefined trigonometric functions Function Meaning Example =========================================================== sin sine sin(pi) = 0.0 cos cosine cos(pi) = -1.0 tan tangent tan(pi/4) = 1.0 asin arcsine asin(1)= 1.5708 acos arccosine acos(1)= 0.0 atan arctangent atan(1)= 0.7854 exp exponential exp(1.0) = 2.7183 log natural logarithm log(2.7183) = 1.0 log10 logarithm base 10 log10(100.0) = 2.0 =========================================================== The arguments of trigonometric functions are given in radians CECOS College of Engineering and IT March – July 2012
  • 13. Practice  Verify that sin2(x)+ cos2(x) = 1  For arbitrary x, the MATLAB code will be: CECOS College of Engineering and IT March – July 2012
  • 14. MATLAB Help  www.mathworks.com  >> help  >> help <command name> CECOS College of Engineering and IT March – July 2012
  • 15. Tasks 1. Write a MATLAB code to verify the formula a2-b2 = (a+b)(a-b) 2. What is the function of the commands, ceil and floor ? Use MATLAB help to learn these commands and then apply them to a constant of 4.5 3. Use MATLAB to find the area of a circle whose radius is 4 CECOS College of Engineering and IT March – July 2012