MATLAB – PT1 The purpose of this workshop is to get you started and to have fun with MATLAB! Let’s talk a little and decide on what we will be covering.

Slides:



Advertisements
Similar presentations
MATLAB – A Computational Methods By Rohit Khokher Department of Computer Science, Sharda University, Greater Noida, India MATLAB – A Computational Methods.
Advertisements

Introduction to MATLAB The language of Technical Computing.
1 EMT 101 – Engineering Programming Dr. Farzad Ismail School of Aerospace Engineering Universiti Sains Malaysia Nibong Tebal Pulau Pinang Week 10.
Lecture 4.
Introduction to Spreadsheets. Learning Target I can input data and do simple calculations in a spreadsheet.
Introduction to MATLAB Northeastern University: College of Computer and Information Science Co-op Preparation University (CPU) 10/20/2003.
Maths for Computer Graphics
1 Introduction to MatLab MatLab stands for Matrix Laboratory. As the name suggests most of the programming operations have as input or output a matrix.
Matrix Mathematics in MATLAB and Excel
Fundamentals of matrices
Chapter 7 Matrix Mathematics Matrix Operations Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Introduction to Matlab Jianguo Wang CSSCR September 2009.
1 Matrix Math ©Anthony Steed Overview n To revise Vectors Matrices n New stuff Homogenous co-ordinates 3D transformations as matrices.
EPSII 59:006 Spring Topics Using TextPad If Statements Relational Operators Nested If Statements Else and Elseif Clauses Logical Functions For Loops.
259 Lecture 15 Introduction to MATLAB. 2 What is MATLAB?  MATLAB, which stands for “MATrix LABoratory” is a high- performance language for technical.
Chapter 10 Review: Matrix Algebra
Chapter 5 Review: Plotting Introduction to MATLAB 7 Engineering 161.
MATLAB INTRO CONTROL LAB1  The Environment  The command prompt Getting Help : e.g help sin, lookfor cos Variables Vectors, Matrices, and Linear Algebra.
Little Linear Algebra Contents: Linear vector spaces Matrices Special Matrices Matrix & vector Norms.
Introduction to MATLAB adapted from Dr. Rolf Lakaemper.
Introduction to MATLAB Session 1 Prepared By: Dina El Kholy Ahmed Dalal Statistics Course – Biomedical Department -year 3.
Computer Applications Week 9 A New Quarter: Excel, PowerPoint, Internet Research.
ECE 1304 Introduction to Electrical and Computer Engineering Section 1.1 Introduction to MATLAB.
Eng Ship Structures 1 Introduction to Matlab.
Matlab Basics Tutorial. Vectors Let's start off by creating something simple, like a vector. Enter each element of the vector (separated by a space) between.
Lecture 28: Mathematical Insight and Engineering.
What is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computation tools. Others include Maple Mathematica MathCad.
If A and B are both m × n matrices then the sum of A and B, denoted A + B, is a matrix obtained by adding corresponding elements of A and B. add these.
Introduction to MATLAB adapted from Dr. Rolf Lakaemper.
Chapter 6 Review: User Defined Functions Introduction to MATLAB 7 Engineering 161.
MATLAB Jirawat Kanjanapitak (Tae). What is MATLAB A computer program for doing numerical computation including; Arithmetic, Polynomials, Graphics, 2-D.
Lecture 1: Matlab Universe
Lecture 20: Choosing the Right Tool for the Job. What is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computation.
Introduction to Matlab  Matlab is a software package for technical computation.  Matlab allows you to solve many numerical problems including - arrays.
Introduction to MATLAB Northeastern University: College of Computer and Information Science Co-op Preparation University (CPU) 10/20/2003.
MATLAB Jirawat Kanjanapitak (Tae). What is MATLAB A computer program for doing numerical computation including; Arithmetic, Polynomials, Graphics, 2-D.
MT411 Robotic Engineering Asian Institution of Technology (AIT) Chapter 1 Introduction to Matrix Narong Aphiratsakun, D.Eng.
CMPS 1371 Introduction to Computing for Engineers VECTORS.
1 Faculty Name Prof. A. A. Saati. 2 MATLAB Fundamentals 3 1.Reading home works ( Applied Numerical Methods )  CHAPTER 2: MATLAB Fundamentals (p.24)
Approximating Derivatives Using Taylor Series and Vandermonde Matrices.
Math 252: Math Modeling Eli Goldwyn Introduction to MATLAB.
Finishing up Chapter 5. Will this code enter the if statement? G=[30,55,10] if G
“Moh’d Sami” AshhabSummer 2008University of Jordan MATLAB By (Mohammed Sami) Ashhab University of Jordan Summer 2008.
If A and B are both m × n matrices then the sum of A and B, denoted A + B, is a matrix obtained by adding corresponding elements of A and B. add these.
To add, subtract, multiply, and divide, absolutely follow the mathematical rules. 1. All the rules 2. The element-per-element operator 3. Ex1: graphing.
How to use MATLAB (using M-files) Double click this icon To start Matlab 6.5.
ENG College of Engineering Engineering Education Innovation Center 1 Arrays in MATLAB Topics Covered: 1.Creating arrays of numbers vectors matrices.
ECE 1304 Introduction to Electrical and Computer Engineering
Linear Algebra Review.
Introduction to MATLAB
13.4 Product of Two Matrices
ECE 1304 Introduction to Electrical and Computer Engineering
Matrices Rules & Operations.
Linear Algebra review (optional)
Prof. Mark Glauser Created by: David Marr
Chapter 7 Matrix Mathematics
INTRODUCTION TO BASIC MATLAB
MATLAB DENC 2533 ECADD LAB 9.
(Mohammed Sami) Ashhab
With an immediate use for it
MATLAB How to use (using M-files) Double click this icon
Use of Mathematics using Technology (Maltlab)
MATLAB – What Is It ? Name is from matrix laboratory Powerful tool for
MATLAB How to use (using M-files) Double click this icon
MATLAB – What Is It ? Name is from matrix laboratory Powerful tool for
MATLAB How to use (using M-files)
Communication and Coding Theory Lab(CS491)
Demo of Basic Matlab Features
Mr Watson’s Introduction to Spreadsheets
Linear Algebra review (optional)
Presentation transcript:

MATLAB – PT1 The purpose of this workshop is to get you started and to have fun with MATLAB! Let’s talk a little and decide on what we will be covering today. WHY MATLAB? WHAT MATLAB IS NOT. SETTING THE TOOL: MATRIX OPERATIONS: XY PLOTS IN MATLAB IMPORTING DATA: SIMULINK:

WHY MATLAB? MATLAB is relatively easy to learn MATLAB code is optimized to be relatively quick when performing matrix operations MATLAB may behave like a calculator or as a programming language MATLAB is interpreted, errors are easier to fix. WHAT MATLAB IS NOT. (Limitations of MATLAB) MATLAB is NOT a general purpose programming language. MATLAB is an interpreted language (making it for the most part slower than a compiled language such as C++) MATLAB is designed for scientific computation and is not suitable for some things (such as parsing text).

SETTING THE TOOL : Open MATLAB:

MATLAB IS A MATRIX CALCULATOR ! MATrix + LABoratory = MATLAB MATRICES What is a matrix? A matrix is a an arrangement of rows and columns, as shown above. One can see that this has 3 rows and 3 columns i.e. it is a 3 by 3 matrix. FOR MATLAB EVERYTHING IS A MATRIX, Question: Is scalar number “5” a matrix for MATLAB? Answer: Yes number “5” is a 1 by 1 matrix.

Creating a matrix is as easy as making a vector, using semicolons (;) to separate the rows of a matrix. If we type A= [1 2 3; 4 5 6; 7 8 9] ; Matlab will receive a matrix A in workspace. If we do A + Enter MATLAB will give what is stored in “A”. One area in which MATLAB excels is matrix computation. We can easily find the transpose of the matrix 'A'. B = A'

Multiply two matrices together. Now let's multiply matrix A & B together. * Note again that MATLAB doesn't require you to deal with matrices as a collection of numbers. MATLAB knows when you are dealing with matrices and adjusts your calculations accordingly. C = A * B

The inverse function Let's find the inverse of a matrix... X = inv(A) and then illustrate the fact that a matrix times its inverse is the identity matrix. I = inv(A) * A MATLAB has functions for nearly every type of common matrix calculation.

Some Basic Matrix Operations Some Basic Matrix Operations First, let's create a simple vector with 9 elements called 'a'. a = [ ] The elements separated by a space here Now let's add 2 to each element of our vector, 'a', and store the result in a new vector. Notice how MATLAB requires no special handling of vector or matrix math. b = a + 2

Creating graphs Creating graphs in MATLAB is as easy as one command. Let's plot the result of Our vector addition with grid lines. plot(b) grid on Or you can put the above commands on one line separated by a semicolon plot(b); grid on

Graphs with axis labels. MATLAB can make other graph types as well, with axis labels. As an example, do this: bar(b); xlabel('Sample #') ylabel('Pounds') The following graph appears

Using symbols in the plot MATLAB can use symbols in plots as well. Here is an example using *'s to Mark the points. MATLAB offers a variety of other symbols and line types. plot(b,'*') axis([ ]) The following graph – or similar-appears:

More XY Plots in MATLAB % The following is a line plot of a chirp x=0:0.05:5; % the above creates a row matrix from 0 to 5 with an interval of 0.05) y=sin(x.^2); plot(x,y); The following plot appears – try to add the command ‘grid on’ and see the difference

The stem plot % Stem plot x = 0:0.1:4; y = sin(x.^2).*exp(-x); stem(x,y) The following graph is obtained

3 D Plots figure; % Mesh Plot of Peaks z=peaks(25); mesh(z);

Simulink type simulink at the command >>simulink or click on this simulink block The following Simulink Library Browser will open up

Try to explore different simulink components to familiarise yourself with it as in the following – go a head and do more exploration on your own!