ECE 1304 Introduction to Electrical and Computer Engineering Section 1.1 Introduction to MATLAB.

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

Multidimensional Array
Introduction to M ATLAB Programming Ian Brooks Institute for Climate & Atmospheric Science School of Earth & Environment
Introduction to MATLAB for Biomedical Engineering BME 1008 Introduction to Biomedical Engineering FIU, Spring 2015 Lesson 2: Element-wise vs. matrix operations.
Introduction to Matlab. I use Matlab for: Data analysis Data plotting Image Analysis Also – Simulations (solving odes/pdes/finite element methods) – Minimisations,
EGR 106 – Week 2 – Arrays Definition, size, and terminology Construction methods Addressing and sub-arrays Some useful functions for arrays Character arrays.
Introduction to MATLAB
EGR 106 – Week 2 – Arrays Definition, size, and terminology Construction methods Addressing and sub-arrays Some useful functions for arrays Character arrays.
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 18P. 1Winter Quarter Introduction to MATLAB.
Introduction to MATLAB 7 for Engineers
Dr. Jie Zou PHY Welcome to PHY 3320 Computational Methods in Physics and Engineering.
Lecture 2 MATLAB fundamentals Variables, Naming Rules, Arrays (numbers, scalars, vectors, matrices), Arithmetical Operations, Defining and manipulating.
Introduction to MATLAB MECH 300H Spring Starting of MATLAB.
Introduction to Array The fundamental unit of data in any MATLAB program is the array. 1. An array is a collection of data values organized into rows and.
Introduction to MATLAB ENGR 1187 MATLAB 1. Programming In The Real World Programming is a powerful tool for solving problems in every day industry settings.
MATLAB Fundamentals.
What is MATLAB ? MATrix LABratory –Originally, it was a front-end to FORTRAN matrix routines developed in the U. of New Mexico and Stanford –Today.
1 MATLAB 基礎. 2 MATLAB  Workspace: environment (address space) where all variables reside  After carrying out a calculation, MATLAB assigns the result.
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.
Introduction to MATLAB Session 1 Prepared By: Dina El Kholy Ahmed Dalal Statistics Course – Biomedical Department -year 3.
MATLAB Tutorials Session I Introduction to MATLAB Rajeev Madazhy Dept of Mechanical Engineering LSU.
REVIEW 2 Exam History of Computers 1. CPU stands for _______________________. a. Counter productive units b. Central processing unit c. Copper.
CSE123 Lecture 5 Arrays and Array Operations. Definitions Scalars: Variables that represent single numbers. Note that complex numbers are also scalars,
1 Lab of COMP 406 Teaching Assistant: Pei-Yuan Zhou Contact: Lab 1: 12 Sep., 2014 Introduction of Matlab (I)
Introduction to MATLAB CBE 502 Mathematical Methods of Engineering Analysis.
MEGN 536 – Computational Biomechanics MATLAB: Getting Started Prof. Anthony J. Petrella Computational Biomechanics Group.
Introduction to Engineering MATLAB – 1 Introduction to MATLAB Agenda Introduction Arithmetic Operations MATLAB Windows Command Window Defining Variables.
Input, Output, and Processing
What is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computation tools. Others include Maple Mathematica MathCad.
Matlab Programming for Engineers Dr. Bashir NOURI Introduction to Matlab Matlab Basics Branching Statements Loops User Defined Functions Additional Data.
Introduction to Engineering MATLAB – 2 Introduction to MATLAB - 2 Agenda Defining Variables MATLAB Windows.
CMPS 1371 Introduction to Computing for Engineers MatLab.
10/24/20151 Chapter 2 Review: MATLAB Environment Introduction to MATLAB 7 Engineering 161.
MATLAB Environment ELEC 206 Computer Applications for Electrical Engineers Dr. Ron Hayne.
Matlab 14.html Cost: $100 Available in labs on Windows and Unix machines.
Introduction to MATLAB ENGR 1181 MATLAB 1. Opening MATLAB  Students, please open MATLAB now.  CLICK on the shortcut icon → Alternatively, select… start/All.
ES 240: Scientific and Engineering Computation. Chapter 2 Chapter 2: MATLAB Fundamentals Uchechukwu Ofoegbu Temple University.
Introduction to MATLAB. CSPP58001 MATLAB MATLAB is is a matrix-based language well suited for carrying out numerical analysis. It has many, many high-
Chapter 1 – Matlab Overview EGR1302. Desktop Command window Current Directory window Command History window Tabs to toggle between Current Directory &
1 DKT 211 Basic Communication Engineering LAB # 1A : (Lecture 1) Introduction to Matlab  Basic Features  Scientific features  Array Operations  Script.
Engineering H192 - Computer Programming Gateway Engineering Education Coalition Lect 18P. 1Winter Quarter Introduction to MATLAB Lecture 18.
Working with Arrays in MATLAB
INTRODUCTION TO MATLAB MATLAB is a software package for computation in engineering, science, and applied mathemat-ics. It offers a powerful programming.
Computer Simulation Lab Electrical and Computer Engineering Department SUNY – New Paltz SUNY-New Paltz “Lecture 2”
A L I MAM M OHAMMAD B IN S AUD I SLAMIC U NIVERSITY C OLLEGE OF S CIENCES D EPARTMENT OF M ATHEMATICS MATLAB 251 : MATH SOFTWARE Introduction to MATLAB.
1 Lecture 1 Post-Graduate Students Advanced Programming (Introduction to MATLAB) Code: ENG 505 Dr. Basheer M. Nasef Computers & Systems Dept.
Part 1 Chapter 2 MATLAB Fundamentals PowerPoints organized by Dr. Michael R. Gustafson II, Duke University and Prof. Steve Chapra, Tufts University All.
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 DAVID COOPER SUMMER Course Layout SundayMondayTuesdayWednesdayThursdayFridaySaturday 67 Intro 89 Scripts 1011 Work
INTRODUCTION TO MATLAB Dr. Hugh Blanton ENTC 4347.
Introduction to Engineering MATLAB – 4 Arrays Agenda Creating arrays of numbers  Vectors: 1-D Arrays  Arrays: 2-D Arrays Array Addressing Strings & String.
Introduction to MATLAB 1.Basic functions 2.Vectors, matrices, and arithmetic 3.Flow Constructs (Loops, If, etc) 4.Create M-files 5.Plotting.
1 Lecture 3 Post-Graduate Students Advanced Programming (Introduction to MATLAB) Code: ENG 505 Dr. Basheer M. Nasef Computers & Systems Dept.
Matlab for Engineers Matlab Environment Chapter 2.
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)
Math 252: Math Modeling Eli Goldwyn Introduction to MATLAB.
BASICS OF MATLAB Engr.Mian Shahzad Iqbal Lecturer,Telecom Department University of Engineering & Technology Taxila.
An Introduction to Programming in Matlab Emily Blumenthal
MATLAB (Matrix Algebra laboratory), distributed by The MathWorks, is a technical computing environment for high performance numeric computation and.
1-2 What is the Matlab environment? How can you create vectors ? What does the colon : operator do? How does the use of the built-in linspace function.
ECE 1304 Introduction to Electrical and Computer Engineering
INTRODUCTION TO BASIC MATLAB
MATLAB DENC 2533 ECADD LAB 9.
Use of Mathematics using Technology (Maltlab)
Communication and Coding Theory Lab(CS491)
Simulation And Modelling
Experiment No. (1) - an introduction to MATLAB
Presentation transcript:

ECE 1304 Introduction to Electrical and Computer Engineering Section 1.1 Introduction to MATLAB

MATLAB MATLAB stands for “Matrix Laboratory.” MATLAB was developed for applications involving matrices, linear algebra and numerical analysis. MATLAB has built-in capacity for complex numbers.

Commands entered here are executed immediately. This is called an Interactive Session. The commands are recorded in the Command History.

Numbers and mathematical operations may be entered directly as if in a calculator. The operation returns a value.

MATLAB assigns the value to a built-in variable named ans.

Scalar Arithmetic Operators

The value assigned to the variable named ans may be used in subsequent calculations.

The user may enter the variable name and use the assignment operator = to assign a value. In this case the variable is named “ r.”

Variable Names Variable names must begin with a letter and may contain up to 32 characters. The characters may include letters, numbers and the under score character. MATLAB is case sensitive. speed and Speed are two different variable names. Chose variable names that make sense for the problem you are solving. This makes programs easier to read.

The Assignment Operator The Assignment Operator = behaves differently than the mathematical equality symbol. MATLAB evaluates the expression on the right hand side of the = operator and then assigns that value to the variable on the left hand side of the operator.

The Assignment Operator The expression x + 2 = y is meaningless in MATLAB. The expression y = x + 2 is appropriate. Provided x has been assigned a value. MATLAB will find the value of x + 2 then assign that value to the variable y. If x does not have a value MATLAB will display an error message.

Numerical Precision MATLAB uses high precision for all of its calculations (14 decimal decimal places?). By default, results are displayed using 4 decimal places. This format may be changed if the user wishes. Numbers are displayed using exponential notation using e to represent a power of ten  10 2 is displayed as e+2

If the name of a variable is entered, MATLAB will display the value of the variable.

After a variable has been assigned a value, that variable may be used in subsequent calculations. The result is assigned to a new variable named s.

MATLAB evaluates this expression as “the new value of s is assigned the old value of s plus 160.”

Expressions are evaluated according to a built-in order of precedence for the mathematical operators.

Order of Precedence

The who operator causes MATLAB to display the names of the variables currently stored in the program. The values of the variables are not displayed.

The whos operator causes MATLAB to display the names of the variables, the vector size of each variable, the number of bytes required by each variable, the class of variable (double precision in this case) an if the variable is complex.

The clear operator removes all variables from memory. The memory space assigned to those variables is reclaimed. Variables may be cleared by name: clear r clear s

The clc operator clears the command window. The clc operator does not clears the memory.

The clc only changes the appearance of the Command Window.

All variables in MATLAB are vectors (arrays) by default. A scalar is a 1  1 vector (array). The colon operator : is used to generate the elements of a vector (array). The operator is evaluated as first element : increment : final value

Think of the vector (array) as a list of numbers all assigned to the variable name t. This vector has one row and nine columns.

The whos operator indicates the vector is 1  9 in size (one row, nine columns). The total size is 72 bytes (9 numbers at 8 bytes each).

The semi-colon operator ; may be used to suppress MATLAB displaying values on the screen. It serves as an end-of-line indicator.

MATLAB has the built-in capacity for complex numbers. A complex number has a real part and an imaginary part. i = j = sqrt(–1) is the imaginary unit. Complex number arithmetic must obey a specific set of rules.

Complex number addition.

Complex number subtraction.

Complex number multiplication.

Complex number division.

The vector x starts at zero and goes to 10 with an increment of The brackets [ ] are used to enclose a vector. The sine operation is performed on each element of the vector x and the results are assigned to a vector y. y has the same number of elements as x.

The plot command creates a graph. plot( horizontal axis vector, vertical axis vector ) The xlabel and ylabel commands print labels on the axes. The axis names are inside the quotation marks.