MATLAB workshop lecture 1.ppt

46
MATLAB WORKSHOP MATLAB WORKSHOP FOR EE 327 FOR EE 327 MWF 8:00-850 AM MWF 8:00-850 AM August 26-30, 2002 August 26-30, 2002 Dr. Ali A. Jalali Dr. Ali A. Jalali

Transcript of MATLAB workshop lecture 1.ppt

Page 1: MATLAB workshop lecture 1.ppt

MATLAB WORKSHOPMATLAB WORKSHOPMATLAB WORKSHOPMATLAB WORKSHOP

• FOR EE 327FOR EE 327• MWF 8:00-850 AMMWF 8:00-850 AM• August 26-30, 2002 August 26-30, 2002

Dr. Ali A. JalaliDr. Ali A. Jalali

Page 2: MATLAB workshop lecture 1.ppt

ABOUT WORKSHOPABOUT WORKSHOPABOUT WORKSHOPABOUT WORKSHOP

Mainly this workshop is designed for EE 327, Signals and Systems 1 course. But it could be used by any other faculty and students who are interested to learn MATLAB

Mainly this workshop is designed for EE 327, Signals and Systems 1 course. But it could be used by any other faculty and students who are interested to learn MATLAB

Page 3: MATLAB workshop lecture 1.ppt

ABOUT WORKSHOPABOUT WORKSHOPABOUT WORKSHOPABOUT WORKSHOP

This workshop is available as a supplement to the textbook Contemporary Linear Systems Using MATLAB by Robert D. Strum and Donald E. Kirk. This is the main textbook for EE 327 in fall 2002.

The workshop covers basic MATLAB commands that are used in introductory signals and systems analysis.

It is meant to serve as a quick way to learn MATLAB and a quick reference to the commands that are used in this textbook.

This workshop is available as a supplement to the textbook Contemporary Linear Systems Using MATLAB by Robert D. Strum and Donald E. Kirk. This is the main textbook for EE 327 in fall 2002.

The workshop covers basic MATLAB commands that are used in introductory signals and systems analysis.

It is meant to serve as a quick way to learn MATLAB and a quick reference to the commands that are used in this textbook.

Page 4: MATLAB workshop lecture 1.ppt

ABOUT WORKSHOPABOUT WORKSHOPABOUT WORKSHOPABOUT WORKSHOP

In this workshop you will learn a few of the basic functions of MATLAB.

First we will start working with basic numbers, formats, demos, mathematical functions, setting variables, matrices and generating plots by using the plot functions.

Brief overview of how to generate scripts in MATLAB called M-files.

In this workshop you will learn a few of the basic functions of MATLAB.

First we will start working with basic numbers, formats, demos, mathematical functions, setting variables, matrices and generating plots by using the plot functions.

Brief overview of how to generate scripts in MATLAB called M-files.

Page 5: MATLAB workshop lecture 1.ppt

ABOUT WORKSHOPABOUT WORKSHOPABOUT WORKSHOPABOUT WORKSHOP

The workshop is designed for students using either the professional version of MATLAB with the Control Systems Toolbox and the Signal Processing Toolbox, or using the Student Edition of MATLAB.

For latest version of MATLAB at the time and more information on MATLAB, contact

The Mathworks, Inc.

www.mathworks.com

The workshop is designed for students using either the professional version of MATLAB with the Control Systems Toolbox and the Signal Processing Toolbox, or using the Student Edition of MATLAB.

For latest version of MATLAB at the time and more information on MATLAB, contact

The Mathworks, Inc.

www.mathworks.com

Page 6: MATLAB workshop lecture 1.ppt

MATLAB WORKSHOPMATLAB WORKSHOPMATLAB WORKSHOPMATLAB WORKSHOP

WORKSHOPWORKSHOP

WebPagesWebPages

www.csee.wvu.edu/~jalali www.csee.wvu.edu/~jalali

Page 7: MATLAB workshop lecture 1.ppt

MATLAB WORKSHOPMATLAB WORKSHOPMATLAB WORKSHOPMATLAB WORKSHOP

Lecture # 1Lecture # 1Monday August 26Monday August 26• IntroductionIntroduction• MATLAB DemosMATLAB Demos

• MATLAB BasicsMATLAB Basics

Lecture # 2Lecture # 2Wednesday August 28Wednesday August 28• MATLAB BasicsMATLAB Basics• MATLAB PlotsMATLAB Plots

• MATLAB ExamplesMATLAB Examples

Lecture # 3Lecture # 3Friday August 30Friday August 30• MATLAB FundationMATLAB Fundation• Textbook ExamplesTextbook Examples

• Short QuizShort Quiz

Page 8: MATLAB workshop lecture 1.ppt

MATLAB WORKSHOPMATLAB WORKSHOPMATLAB WORKSHOPMATLAB WORKSHOP

Lecture # 1Lecture # 1Monday August 26Monday August 26• IntroductionIntroduction• MATLAB DemosMATLAB Demos

• MATLAB BasicsMATLAB Basics

Page 9: MATLAB workshop lecture 1.ppt

MATLAB IntroductionMATLAB IntroductionMATLAB IntroductionMATLAB Introduction

MATLAB is both computer programming language and software environment for using that language effectively.

MATLAB is matrix-oriented, so what would take several statements in C or Fortran can usually be accomplished in just a few lines using MATLAB's built-in matrix and vector operations

MATLAB is both computer programming language and software environment for using that language effectively.

MATLAB is matrix-oriented, so what would take several statements in C or Fortran can usually be accomplished in just a few lines using MATLAB's built-in matrix and vector operations

Page 10: MATLAB workshop lecture 1.ppt

MATLAB IntroductionMATLAB IntroductionMATLAB IntroductionMATLAB Introduction

FORTRAN:FORTRAN:    real*8 A(10,10), B(10,10), C(10,10) real*8 A(10,10), B(10,10), C(10,10)

   do i=1,10    do i=1,10    do j=1,10    do j=1,10        C(i,j) = A(i,j) + B(i,j)        C(i,j) = A(i,j) + B(i,j) 10 continue 10 continue 20 continue 20 continue

MATLAB:MATLAB: C = A + BC = A + B   

 

FORTRAN:FORTRAN:    real*8 A(10,10), B(10,10), C(10,10) real*8 A(10,10), B(10,10), C(10,10)

   do i=1,10    do i=1,10    do j=1,10    do j=1,10        C(i,j) = A(i,j) + B(i,j)        C(i,j) = A(i,j) + B(i,j) 10 continue 10 continue 20 continue 20 continue

MATLAB:MATLAB: C = A + BC = A + B   

 

Page 11: MATLAB workshop lecture 1.ppt

MATLAB IntroductionMATLAB IntroductionMATLAB IntroductionMATLAB Introduction

MATLAB is available for MS Windows, Macintosh personal computer, Unix and other operating systems.

MATLAB is available for MS Windows, Macintosh personal computer, Unix and other operating systems.

Page 12: MATLAB workshop lecture 1.ppt

MATLAB IntroductionMATLAB IntroductionMATLAB IntroductionMATLAB Introduction

MATLAB, which stands for MATrix LABoratory, is a powerful, general-purpose system or environment for doing mathematics, scientific and engireeng calculations.

MATLAB, which stands for MATrix LABoratory, is a powerful, general-purpose system or environment for doing mathematics, scientific and engireeng calculations.

Page 13: MATLAB workshop lecture 1.ppt

MATLAB IntroductionMATLAB IntroductionMATLAB IntroductionMATLAB Introduction

MATLAB is a "High-Performance Numeric Computation and Visualization Software" package.

MATLAB is a "High-Performance Numeric Computation and Visualization Software" package.

Page 14: MATLAB workshop lecture 1.ppt

MATLAB IntroductionMATLAB IntroductionMATLAB IntroductionMATLAB Introduction

MATLAB is an interactive system whose basic data is a matrix that does not require dimensioning.

MATLAB is an interactive system whose basic data is a matrix that does not require dimensioning.

Page 15: MATLAB workshop lecture 1.ppt

MATLAB IntroductionMATLAB IntroductionMATLAB IntroductionMATLAB Introduction

MATLAB supports many types of graph and surface plots:

• line plots (x vs. y), • filled plots, • bar charts, • pie charts, • parametric plots, • polar plots, • contour plots, • density plots, • log axis plots, • surface plots, • parametric plots in 3 dimensions and spherical

plots.

MATLAB supports many types of graph and surface plots:

• line plots (x vs. y), • filled plots, • bar charts, • pie charts, • parametric plots, • polar plots, • contour plots, • density plots, • log axis plots, • surface plots, • parametric plots in 3 dimensions and spherical

plots.

Page 16: MATLAB workshop lecture 1.ppt

MATLAB IntroductionMATLAB IntroductionMATLAB IntroductionMATLAB Introduction

• MATLAB has a number of add-on software modules, called toolbox , that perform more specialized computations.

Signal & Image Processing 

Signal Processing- Image Processing Communications - System Identification - Wavelet  Filter Design    

Control Design 

Control System - Fuzzy Logic - Robust Control - µ-Analysis and Synthesis - LMI Control  - Model Predictive Control Model-Based Calibration

More than 60 toolboxes!More than 60 toolboxes!

• MATLAB has a number of add-on software modules, called toolbox , that perform more specialized computations.

Signal & Image Processing 

Signal Processing- Image Processing Communications - System Identification - Wavelet  Filter Design    

Control Design 

Control System - Fuzzy Logic - Robust Control - µ-Analysis and Synthesis - LMI Control  - Model Predictive Control Model-Based Calibration

More than 60 toolboxes!More than 60 toolboxes!

Page 17: MATLAB workshop lecture 1.ppt

MATLAB Introduction MATLAB Introduction MATLAB Introduction MATLAB Introduction

• In Windows systems MATLAB is started by double-clicking the mouse on the appropriate icon.

• In Windows systems MATLAB is started by double-clicking the mouse on the appropriate icon.

Page 18: MATLAB workshop lecture 1.ppt

MATLABMATLABCommandCommandWindowWindow

Page 19: MATLAB workshop lecture 1.ppt

FileFile

Page 20: MATLAB workshop lecture 1.ppt

EditEdit

Page 21: MATLAB workshop lecture 1.ppt

ViewView

Page 22: MATLAB workshop lecture 1.ppt

ViewView

Page 23: MATLAB workshop lecture 1.ppt

ViewView

Page 24: MATLAB workshop lecture 1.ppt

WebWeb

Page 25: MATLAB workshop lecture 1.ppt

HelpHelp

Page 26: MATLAB workshop lecture 1.ppt
Page 27: MATLAB workshop lecture 1.ppt

MATLAB IntroductionMATLAB IntroductionMATLAB IntroductionMATLAB Introduction

MATLAB includes hundreds of functions for:

• Data analysis and visualization,

• Numeric and symbolic computation,

• Engineering and Scientific graphics,

• Modeling, simulation, and prototyping,

• Eigenvalue, singular value

MATLAB includes hundreds of functions for:

• Data analysis and visualization,

• Numeric and symbolic computation,

• Engineering and Scientific graphics,

• Modeling, simulation, and prototyping,

• Eigenvalue, singular value

Page 28: MATLAB workshop lecture 1.ppt

MATLAB Demos MATLAB Demos MATLAB Demos MATLAB Demos

• Demonstrations are invaluable since they give an indication of the MATLAB capabilities.

• A comprehensive set are available by typing the command >>demo in MATLAB prompt.

• Demonstrations are invaluable since they give an indication of the MATLAB capabilities.

• A comprehensive set are available by typing the command >>demo in MATLAB prompt.

Page 29: MATLAB workshop lecture 1.ppt
Page 30: MATLAB workshop lecture 1.ppt

MATLAB DemosMATLAB DemosMATLAB DemosMATLAB Demos

MATLAB works with scalars, vectors and matrices:

• Basic matrix operations,

• Inverses of matrices,

• Graphs of matrices,

• Matrix manipulation,

• Programming, application development, and GUI design

MATLAB works with scalars, vectors and matrices:

• Basic matrix operations,

• Inverses of matrices,

• Graphs of matrices,

• Matrix manipulation,

• Programming, application development, and GUI design

Page 31: MATLAB workshop lecture 1.ppt
Page 32: MATLAB workshop lecture 1.ppt

MATLAB DemosMATLAB DemosMATLAB DemosMATLAB Demos

MATLAB has remarkable graphics capacities:

• 2-D and 3-D plots,

• Line plotting,

• 3-D surface plot,

• Splash screen plot,

• Plot of complex functions and ...

MATLAB has remarkable graphics capacities:

• 2-D and 3-D plots,

• Line plotting,

• 3-D surface plot,

• Splash screen plot,

• Plot of complex functions and ...

Page 33: MATLAB workshop lecture 1.ppt
Page 34: MATLAB workshop lecture 1.ppt

MATLAB DemosMATLAB DemosMATLAB DemosMATLAB Demos

MATLAB has remarkable graphics capacities, 3_D plots are some of them:

• 3-D plots in Handel Graphics

• Plot Type,

• Shading,

• Colomap,

• Axis and ...

MATLAB has remarkable graphics capacities, 3_D plots are some of them:

• 3-D plots in Handel Graphics

• Plot Type,

• Shading,

• Colomap,

• Axis and ...

Page 35: MATLAB workshop lecture 1.ppt
Page 36: MATLAB workshop lecture 1.ppt

MATLAB DemosMATLAB DemosMATLAB DemosMATLAB Demos

MATLAB has remarkable graphics capacities, gallery is one of them:

• The Gallery is a place to hang particularly elegant examples of graphics visualization in MATLAB.

• Knot, • Quiver, • Klein II, • Cruller and ...

MATLAB has remarkable graphics capacities, gallery is one of them:

• The Gallery is a place to hang particularly elegant examples of graphics visualization in MATLAB.

• Knot, • Quiver, • Klein II, • Cruller and ...

Page 37: MATLAB workshop lecture 1.ppt
Page 38: MATLAB workshop lecture 1.ppt

MATLAB DemosMATLAB DemosMATLAB DemosMATLAB Demos

MATLAB has many toolboxes:

• Control toolbox is one of the important toolbox in MATLAB.

• RLC Circuit Response,

• Gain and Phase Margins,

• Notch Filter Discrete,

• PID and ...

MATLAB has many toolboxes:

• Control toolbox is one of the important toolbox in MATLAB.

• RLC Circuit Response,

• Gain and Phase Margins,

• Notch Filter Discrete,

• PID and ...

Page 39: MATLAB workshop lecture 1.ppt
Page 40: MATLAB workshop lecture 1.ppt

MATLAB DemosMATLAB DemosMATLAB DemosMATLAB Demos

MATLAB has many toolboxes: • Signal Processing toolbox is one of

the important toolobx in MATLAB. • Designing Filter, • Filtering a Signal, • Discrete and Continuous Fourier

Transform, • Spectral Analysis and ...

MATLAB has many toolboxes: • Signal Processing toolbox is one of

the important toolobx in MATLAB. • Designing Filter, • Filtering a Signal, • Discrete and Continuous Fourier

Transform, • Spectral Analysis and ...

Page 41: MATLAB workshop lecture 1.ppt
Page 42: MATLAB workshop lecture 1.ppt

MATLAB DemosMATLAB DemosMATLAB DemosMATLAB Demos

• Simulink has the ability to simulate a large range of systems, from very simple to extraordinarily complex. The Model and demonstrations that you will see in this section include both simple and complex systems.

• Simulink has the ability to simulate a large range of systems, from very simple to extraordinarily complex. The Model and demonstrations that you will see in this section include both simple and complex systems.

Page 43: MATLAB workshop lecture 1.ppt
Page 44: MATLAB workshop lecture 1.ppt

MATLAB DemosMATLAB DemosMATLAB DemosMATLAB Demos

Simulink has the ability to simulate a large range of systems, in the menu of Simulation we have:

• Pause.

• Stop,

• Simulation Parameters,

• Start,

Simulink has the ability to simulate a large range of systems, in the menu of Simulation we have:

• Pause.

• Stop,

• Simulation Parameters,

• Start,

Page 45: MATLAB workshop lecture 1.ppt
Page 46: MATLAB workshop lecture 1.ppt

MATLAB WORKSHOPMATLAB WORKSHOPMATLAB WORKSHOPMATLAB WORKSHOP

End of Lecture # 1End of Lecture # 1

MATLAB Basics MATLAB Basics

Next Next timetime