ECE 1304 Introduction to Electrical and Computer Engineering

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 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
Lecture 2 MATLAB fundamentals Variables, Naming Rules, Arrays (numbers, scalars, vectors, matrices), Arithmetical Operations, Defining and manipulating.
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.
MATLAB Fundamentals.
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.
Introduction to MATLAB January 18, 2008 Steve Gu Reference: Eta Kappa Nu, UCLA Iota Gamma Chapter, Introduction to MATLAB,
MATLAB Tutorials Session I Introduction to MATLAB Rajeev Madazhy Dept of Mechanical Engineering LSU.
1 Lab of COMP 406 Teaching Assistant: Pei-Yuan Zhou Contact: Lab 1: 12 Sep., 2014 Introduction of Matlab (I)
MEGN 536 – Computational Biomechanics MATLAB: Getting Started Prof. Anthony J. Petrella Computational Biomechanics Group.
ECE 1304 Introduction to Electrical and Computer Engineering Section 1.1 Introduction to MATLAB.
Introduction to Engineering MATLAB – 1 Introduction to MATLAB Agenda Introduction Arithmetic Operations MATLAB Windows Command Window Defining Variables.
What is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computation tools. Others include Maple Mathematica MathCad.
10/24/20151 Chapter 2 Review: MATLAB Environment Introduction to MATLAB 7 Engineering 161.
CHAPTER 4: CONTROL STRUCTURES - SEQUENCING 10/14/2014 PROBLEM SOLVING & ALGORITHM (DCT 1123)
MATLAB Technical Computing Environment. MATLAB Matlab is an interactive computing environment that enables numerical computation and data visualization.
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”
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 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.
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)
BASICS OF MATLAB Engr.Mian Shahzad Iqbal Lecturer,Telecom Department University of Engineering & Technology Taxila.
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.
Arithmetic Operations
Topics Designing a Program Input, Processing, and Output
ECE 1304 Introduction to Electrical and Computer Engineering
ECE 1304 Introduction to Electrical and Computer Engineering
Chapter 3 Arrays and Vectors
Lecture: MATLAB Chapter 1 Introduction
Introduction to Algebra
Other Kinds of Arrays Chapter 11
2) Platform independent 3) Predefined functions
INTRODUCTION TO BASIC MATLAB
MATLAB DENC 2533 ECADD LAB 9.
EEE 244 Numerical Methods In Electrical Engineering
Part 1 Chapter 2 MATLAB Fundamentals
Use of Mathematics using Technology (Maltlab)
Lecture 2 Introduction to MATLAB
Vectors and Matrices I.
Communication and Coding Theory Lab(CS491)
Introduction to MATLAB
INTRODUCTION TO MATLAB
Topics Designing a Program Input, Processing, and Output
Simulation And Modelling
Experiment No. (1) - an introduction to MATLAB
Topics Designing a Program Input, Processing, and Output
MATLAB Introduction MATLAB can be thought of as a powerful graphing calculator but with a lot more buttons! It is also a programming language, commands.
CS 111 Introduction to Computing in Engineering and Science
Matlab Basics.
EECS Introduction to Computing for the Physical Sciences
Working with Arrays in MATLAB
Computer Simulation Lab
MatLab Program Used to Calculate Interactive
Chapter 2 MATLAB Environment
Electrical and Computer Engineering Department SUNY – New Paltz
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 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. 5.3164  102 is displayed as 5.3164e+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.

When a name of a variable is entered, MATLAB evaluates the statement by returning the numerical value stored at the memory location given by the variable name.

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 Precedence Operation First Parentheses (), evaluated starting with the innermost pair. Second Unary plus (+), unary minus (-) Third Exponentiation (^), evaluated from left to right Forth Multiplication (*) and division (/) with equal precedence, evaluated from left to right Fifth Addition (+) and subtraction (-) with equal precedence evaluated from Left to right

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 0.01. 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.