Structured Computer Programming EE 201 Introduction to MATLAB 7 for Engineers بسم الله الرحمن الرحيم King Abdulaziz University College of Engineering Dept.

Slides:



Advertisements
Similar presentations
Maths & Trig, Statistical functions. ABS Returns the absolute value of a number The absolute value of a number is the number without its sign Syntax ◦
Advertisements

ES 314 Lecture 2 Sep 1 Summary of lecture 1: course overview intro to matlab sections of Chapters 2 and 3.
Lecture 6 MATLAB functions Basics of Built-in Functions, Help Feature, Elementary Functions (e.g., Polynomials, Trigonometric Functions), Data Analysis,
Lecture 4 Sept 8 Complete Chapter 3 exercises Chapter 4.
Introduction to MATLAB
Introduction to MATLAB 7 for Engineers
Lecture 6 Sept 15, 09 Goals: two-dimensional arrays matrix operations circuit analysis using Matlab image processing – simple examples.
Concatenation MATLAB lets you construct a new vector by concatenating other vectors: – A = [B C D... X Y Z] where the individual items in the brackets.
Matlab Intro. Outline Matlab introduction Matlab elements Types Variables Matrices.
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.
Chapter 4 MATLAB Programming Combining Loops and Logic Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Chapter 10 Review: Matrix Algebra
MATLAB INTRO CONTROL LAB1  The Environment  The command prompt Getting Help : e.g help sin, lookfor cos Variables Vectors, Matrices, and Linear Algebra.
Martin Ellison University of Warwick and CEPR Bank of England, December 2005 Introduction to MATLAB.
Engineering Analysis ENG 3420 Fall 2009 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 11:00-12:00.
1 M ATLAB Short Course. History of Calculator 2 3 Introduction to Matlab Matlab is short for Matrix Laboratory Matlab is also a programming language.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. A Concise Introduction to MATLAB ® William J. Palm III.
MATLAB Tutorials Session I Introduction to MATLAB Rajeev Madazhy Dept of Mechanical Engineering LSU.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. A Concise Introduction to MATLAB ® William J. Palm III.
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.
Learner’s Guide to MATLAB® Chapter 2 : Working with Arrays.
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.
Computational Methods of Scientific Programming Lecturers Thomas A Herring, Room A, Chris Hill, Room ,
Copyright © The McGraw-Hill Companies, Inc. Introduction to MATLAB for Engineers, Third Edition William J. Palm III Chapter 1 An Overview of MATLAB.
CMPS 1371 Introduction to Computing for Engineers MATRICES.
A Brief introduction to MatLAB ($50 - $99 for students)
© 2005 Pearson Education, Inc. publishing as Longman Publishers. Chapter 6: Textbook Learning Breaking Through: College Reading, 7/e Brenda Smith.
1 Week 2: Variables and Assignment Statements READING: 1.4 – 1.6 EECS Introduction to Computing for the Physical Sciences.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Introduction to MATLAB 7 for Engineers William J. Palm.
MAE 1202: AEROSPACE PRACTICUM An Introduction to MATLAB: Part 2 Mechanical and Aerospace Engineering Department Florida Institute of Technology Developed.
Computational Methods of Scientific Programming Lecturers Thomas A Herring, Room , Chris Hill, Room ,
Introduction to Matlab
ENGR-25_MATLAB_OverView-2.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical.
ENG College of Engineering Engineering Education Innovation Center 1 Array Accessing and Strings in MATLAB Topics Covered: 1.Array addressing. 2.
CS 170 – INTRO TO SCIENTIFIC AND ENGINEERING PROGRAMMING.
MATLAB Lecture Two Tuesday 5 July Chapter 3.
1 Lecture 1 Post-Graduate Students Advanced Programming (Introduction to MATLAB) Code: ENG 505 Dr. Basheer M. Nasef Computers & Systems Dept.
ES 240: Scientific and Engineering Computation. Chapter 8 Chapter 8: Linear Algebraic Equations and Matrices Uchechukwu Ofoegbu Temple University.
ENG College of Engineering Engineering Education Innovation Center 1 Basic For Loops in MATLAB Programming in MATLAB / Chapter 6 Topics Covered:
EGR 115 Introduction to Computing for Engineers MATLAB Basics 6: Debugging in MATLAB Monday 15 Sept 2014 EGR 115 Introduction to Computing for Engineers.
INTRODUCTION TO MATLAB DAVID COOPER SUMMER Course Layout SundayMondayTuesdayWednesdayThursdayFridaySaturday 67 Intro 89 Scripts 1011 Work
Digital Image Processing Introduction to MATLAB. Background on MATLAB (Definition) MATLAB is a high-performance language for technical computing. The.
1 Lecture 4 Post-Graduate Students Advanced Programming (Introduction to MATLAB) Code: ENG 505 Dr. Basheer M. Nasef Computers & Systems Dept.
1 Lecture 5 Post-Graduate Students Advanced Programming (Introduction to MATLAB) Code: ENG 505 Dr. Basheer M. Nasef Computers & Systems Dept.
September 15, 2005 Lecture 5 - By Paul Lin 1 CPET 190 Lecture 5 Problem Solving with MATLAB
MT411 Robotic Engineering Asian Institution of Technology (AIT) Chapter 1 Introduction to Matrix Narong Aphiratsakun, D.Eng.
EGR 115 Introduction to Computing for Engineers MATLAB Basics 1: Variables & Arrays Wednesday 03 Sept 2014 EGR 115 Introduction to Computing for Engineers.
1 Lecture 3 Post-Graduate Students Advanced Programming (Introduction to MATLAB) Code: ENG 505 Dr. Basheer M. Nasef Computers & Systems Dept.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. A Concise Introduction to MATLAB ® William J. Palm III.
MATLAB Constants, Variables & Expression Nafees Ahmed Asstt. Professor, EE Deptt DIT, DehraDun.
STROUD Worked examples and exercises are in the text 1 STROUD Worked examples and exercises are in the text Programme F4: Graphs PROGRAMME F4 GRAPHS.
Structured Computer Programming EE 201 Introduction to MATLAB 7 for Engineers بسم الله الرحمن الرحيم King Abdulaziz University College of Engineering Dept.
Relational and Logical Operators EE 201 1C7-2 Spring 2012.
ENG College of Engineering Engineering Education Innovation Center 1 Arrays in MATLAB Topics Covered: 1.Creating arrays of numbers vectors matrices.
1 MATLAB 입문 An Overview of MATLAB. An Overview of MATLAB 2 Starting Matlab The default MATLAB Desktop.
MATLAB The name of MATLAB stands for matrix laboratory. Starting a MATLAB Session -On Microsoft® Windows® platforms, start the MATLAB program by double-clicking.
MTH108 Business Math I Lecture 20.
Umm Al-Qura University
13.4 Product of Two Matrices
ECE 1304 Introduction to Electrical and Computer Engineering
ECE 1304 Introduction to Electrical and Computer Engineering
Introduction to MATLAB for Engineers, Third Edition
Computer Simulation Lab
Fourth Year – Software Engineering
Matrix A matrix is a rectangular arrangement of numbers in rows and columns Each number in a matrix is called an Element. The dimensions of a matrix are.
Computer Simulation Lab
Presentation transcript:

Structured Computer Programming EE 201 Introduction to MATLAB 7 for Engineers بسم الله الرحمن الرحيم King Abdulaziz University College of Engineering Dept of Electrical & Computer Engineering

Chapter 1 Lecture 3 Basic Syntax and Command A’ Inverse Matrix A A(n,d) Elements in row n & column d RESHAPE Change size RESHAPE(A,s,z) condition s*z = k*m m columns K rows

flipud(A) FLIPUD Flip matrix in up/down direction. FLIPUD(X) returns X with columns preserved and rows flipped in the up/down direction. For example, X = 1 4 becomes fliplr(A) FLIPLR Flip matrix in left/right direction. FLIPLR(X) returns X with row preserved and columns flipped in the left/right direction. X = becomes

Exercise: If x = [ ] Summarize the net result of the command. a. x(3) b. x(1:7) c. x(1:end) d. x(1:end-1) e. x(6:-2:1) f. x([ ]) g. sum(x)

Matrix & Array If A = [ a11,a12; a21,a22] & B = [ b11,b12; b21,b22] there is a difference between * and.* * is Matrix multiply A*B = [ a11* b11 + a11 *b21, a12* b11 + a12 *b21, a21* b21 + a21 *b22, a22* b21 + a22 *b22] But.* is Array multiply A.*B = [ a11* b11, a12 *b12 ; a21*b21, a22*b22] Do it by your self and note what is the difference between (./ and / ), (.\ and \ )

Extra commands floor Round towards minus infinity. floor(X) rounds the elements of X to the nearest integers towards minus infinity. ceil Round towards plus infinity. ceil(X) rounds the elements of X to the nearest integers towards infinity. fix Round towards zero. fix(X) rounds the elements of X to the nearest integers towards zero. round Round towards nearest integer. round(X) rounds the elements of X to the nearest integers.

Getting Help King Abdulaziz University EE 201 Eng. Ghassan R. Alnwaimi Throughout each chapter margin notes identify where key terms are introduced. Each chapter contains tables summarizing the MATLAB commands introduced in that chapter. At the end of each chapter is a summary guide to the commands covered in that chapter. Appendix A contains tables of MATLAB commands, grouped by category, with the appropriate page references. There are three indexes. The first lists MATLAB commands and symbols, the second lists Simulinkblocks, and the third lists topics.

The Help Navigator contains four tabs: Contents: a contents listing tab, Index: a global index tab, Search: a search tab having a find function and full text search features, Demos: a book marking tab to start built-in demonstrations.

The MATLAB Help Browser.

Help Functions help funcname: Displays in the Command window a description of the specified function funcname. lookfor topic: Displays in the Command window a brief description for all functions whose description includes the specified key word topic. doc funcname: Opens the Help Browser to the reference page for the specified function funcname, providing a description, additional remarks, and examples.

Relational operators Relational Meaning operator < Less than. <= Less than or equal to. > Greater than. >= Greater than or equal to. == Equal to. ~= Not equal to.

Examples of Relational Operators >> x = [6,3,9]; y = [14,2,9]; >> z = (x < y) z =1 0 0 >>z = ( x > y) z =0 1 0 >>z = (x ~= y) z =1 1 0 >>z = ( x == y) z =0 0 1 >>z = (x > 8) z =0 0 1

The find Function find(x) computes an array containing the indices of the non zero elements of the numeric array x. For example >>x = [-2, 0, 4]; >>y = find(x) y =1 3 The resulting array y = [1, 3]indicates that the first and third elements of x are nonzero.

Note the difference between the result obtained by x(x<y) and the result obtained by find(x<y). >>x = [6,3,9,11];y = [14,2,9,13]; >>values = x(x<y) values =6 11 >>how_many = length(values) how_many =2 >>indices = find(x<y) indices =1 4

Extra in Plotting rectangular Paper semi log paper (logarithm on the y-axis) log-log paper