Fourth Year – Software Engineering

Slides:



Advertisements
Similar presentations
Introduction to Matlab
Advertisements

Introduction to MATLAB The language of Technical Computing.
MATLAB – What is it? Computing environment / programming language Tool for manipulating matrices Many applications, you just need to get some numbers in.
CMPS 1371 Introduction to Computing for Engineers FUNCTIONS.
EGR 106 – Week 2 – Arrays Definition, size, and terminology Construction methods Addressing and sub-arrays Some useful functions for arrays Character arrays.
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.
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.
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.
MATLAB Lecture One Monday 4 July Matlab Melvyn Sim Department of Decision Sciences NUS Business School
MATLAB INTRO CONTROL LAB1  The Environment  The command prompt Getting Help : e.g help sin, lookfor cos Variables Vectors, Matrices, and Linear Algebra.
BRIAN D. HAHN AND DANIEL T. VALENTINE THIRD EDITION Essential MATLAB® for Engineers and Scientists.
Predefined MATLAB Functions ELEC 206 Computer Applications for Electrical Engineers Dr. Ron Hayne.
REVIEW 2 Exam History of Computers 1. CPU stands for _______________________. a. Counter productive units b. Central processing unit c. Copper.
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)
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.
MATLAB An Introduction to MATLAB (Matrix Laboratory) 1.
Matlab for Engineers Built-in Matlab Functions Chapter 3.
Computational Methods of Scientific Programming Lecturers Thomas A Herring, Room A, Chris Hill, Room ,
What is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computation tools. Others include Maple Mathematica MathCad.
Introduction to Matlab Module #2 Page 1 Introduction to Matlab Module #2 – Arrays Topics 1.Numeric arrays (creation, addressing, sizes) 2.Element-by-Element.
10/24/20151 Chapter 2 Review: MATLAB Environment Introduction to MATLAB 7 Engineering 161.
Advanced Topics- Functions Introduction to MATLAB 7 Engineering 161.
MATLAB for Engineers 4E, by Holly Moore. © 2014 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright.
INTRODUCTION TO MATLAB MATLAB is a software package for computation in engineering, science, and applied mathemat-ics. It offers a powerful programming.
Lecture 20: Choosing the Right Tool for the Job. What is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computation.
Matlab Basic. MATLAB Product Family 2 3 Entering & Quitting MATLAB To enter MATLAB double click on the MATLAB icon. To Leave MATLAB Simply type quit.
1 EMT 101 – Engineering Programming Dr. Farzad Ismail School of Aerospace Engineering Universiti Sains Malaysia Nibong Tebal Pulau Pinang Week 10.
The Hong Kong Polytechnic University Industrial Centre MatLAB Lesson 1 : Overview & Environment Edward Cheung Room W311g.
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.
Lecture 24: Rough and Ready Analysis. MATLAB uses function names consistent with most major programming languages For example sqrt sin cos log.
MATLAB Lecture 1 염익준. Introduction MATLAB (MATrix LABoratory) a special purpose computer program optimized to perform engineering and scientific calculations.
NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS ( NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS (PRACTICAL PART) Tutorial 2 : Matlab - Getting Started.
Introduction to Programming on MATLAB Ecological Modeling Course Sep 11th, 2006.
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.
Some “What’s the output” questions to get the day started… >>A = [1 2 3; 3 5 6] This statement stores the matrix: 1. A= 2. A= 3. A= 4. A= Ask Garvin’s.
ECE 1304 Introduction to Electrical and Computer Engineering
Introduction to Matlab
ECE 1304 Introduction to Electrical and Computer Engineering
Numeric, Cell and Structural Arrays One of the strenghts of MATLAB is the capabilty to handle collection of numbers called ARRAYS. MATLAB refers to scalars,
ECE 1304 Introduction to Electrical and Computer Engineering
Built-in MATLAB Functions Chapter 3
Introduction to Matlab
MATLAB Basics Nafees Ahmed Asstt. Professor, EE Deptt DIT, DehraDun.
Introduction to MATLAB
INTRODUCTION TO BASIC MATLAB
MATLAB DENC 2533 ECADD LAB 9.
Matlab Workshop 9/22/2018.
EEE 244 Numerical Methods In Electrical Engineering
StatLab Matlab Workshop
MATLAB (Lecture 2) BY:MAHA ALMOUSA.
Use of Mathematics using Technology (Maltlab)
StatLab Workshop: Intro to Matlab for Data Analysis and Statistical Modeling 11/29/2018.
Lecture 2 Introduction to MATLAB
Vectors and Matrices I.
Communication and Coding Theory Lab(CS491)
Introduction to Matlab
Matlab Intro.
INTRODUCTION TO MATLAB
CSCI N317 Computation for Scientific Applications Unit 1 – 1 MATLAB
Matlab Basic Dr. Imtiaz Hussain
Experiment No. (1) - an introduction to MATLAB
Using Script Files and Managing Data
MATLAB (Lecture 2) BY:MAHA ALMOUSA.
Matlab Intro.
Computer Simulation Lab
Presentation transcript:

Fourth Year – Software Engineering Image Processing Fourth Year – Software Engineering Introduction

Introduction Menu bar Tool bar Current directory Work space Current folder Command window History command

Introduction Cont. version Pwd (returns the current folder as a character vector to currentFolder .) Cd (Change working directory) cd .. cd D:\ mkdir D:\name clc clear exit or quit help about Lookfor (to search functions for keyword.)

Entering Commands The MATLAB command prompt: >> At this prompt you can enter commands to: – Create or modify a variable: E.g. A = 3 – Perform a computation: E.g. 1 + 2 – Call a function: E.g. max([1 2 3]) – Get help: E.g. help, help max – Save workspace variables: E.g. save Afile A – and some other things.

Variables and basic arithmetic Variables are declared at any time in your code. Simply use = operator E.g. A=3 MATLAB is much like any other language for performing basic arithmetic MATLAB can perform arithmetic directly at the command line: E.g. 1 + 2 Strings are declared using ’’: E.g. S = ’string’

Returning computation results MATLAB can return a computation to a variable: E.g. >> B = A + 3 B = 6 MATLAB can perform arithmetic directly at the command line: E.g. 1 + 2 >>1 + 2 ans = 3 No permanent variable is assigned. But the temporary variable ans is returned. (This is an important basic notion of MATLAB)

>> A = 3 A = 3 >> A = 3; >> B = A + 3; >> B Semicolon terminated commands Semicolon typically ends statements in MATLAB. Strictly speaking the return or newline ends the statement (forces evaluation) If semicolon is omitted then the result of the computation is echoed to the command window: >> 6+5 ans = 11 >> 6+5; >> ans; >> ans >> A = 3 A = 3 >> A = 3; >> B = A + 3; >> B B = 6

Matrices or Arrays MATLAB works with essentially only one kind of object — a rectangular numerical matrix with possibly complex entries: All variables represent matrices. In some situations, 1-by-1 matrices are interpreted as scalars and matrices with only one row or one column are interpreted as vectors.

Introduction Cont. Input a row or column vector a=1 or a=[1] a=[1 2 3 4] or a=[1,2,3,4] or a=[1:4] or a=[1:1:4] or a= 1:4 a=[1;2;3;4] or a=[1 2 3 4]’ or a=[1:4]’ b=[1:2:10] b=[10:2:1] input matrix: a=[1 2 ;3 4] or a=[1:2;3:4] or a=[1 2; 3, 4] a=[1 2;3 4]’ a=[1 2 3 4;5 6 7 8;8:-2:2] Cell array x={[1 2;3 4],[5 6;7 8]} x={[1 2;3 4],[5 6;7 8];[9 10],[11 12]}

Introduction Cont. x=[1:4;2:2:8;8:-2:2;4:-1:1] 1 2 3 4 2 4 6 8 8 6 4 2 1 2 3 4 2 4 6 8 8 6 4 2 4 3 2 1 y= x(3,2) // y=6 y= x(2,:) // y=[2 4 6 8] y= x(2,3:4) // y= [6 8] y=x(4, 2:end) // [3 2 1] y= x(:,:) //equivalent to x=y y= x(:) //convert x to column vector x=

Complex conjugate transpose Specify evaluation order Introduction Cont. Operation Description + Addition - Subtraction *, .* Multiplication /, ./ Division \, .\ Left division ^, . ^ Power ' Complex conjugate transpose ( ) Specify evaluation order

Introduction Cont. x=[2 4;1 3] y=[3 2;4 2] z=x+y // z=[ 5 6;5 5]

Introduction create special matrices: x=ones(3,3) or x=ones(3) x=zeros(2,3) eye(3) // 3*3 identity matrix x=magic(3) y=diag(a) x=rand(3,4) Random matrix contains value between 0-50? fix(x) Round to words zero (2.7=2 & -2.7=-2) floor(x) Round to words minus infinity (2.7=2 & -2.7=-3) ceil(x) Round to words plus infinity (2.7=3 & -2.7=-2) round(x) Round to words nearest integer (2.7=3 & 2.4=2) randperm(10)

Introduction x=round(20*rand(4,3)) [m n]=size(x) length(x) numel(x) // equivalent to m*n repmat(x,2,3) reshape(x,1,[]) //equivalent to reshape(x,1,m*n) y=2*x cat(1,x,y) cat(2,x,y)

Introduction max(x) max(x,3) max(x,y) min(x) min(x,4) sort(x) // sort(x,'descend') or sort(x,‘ascend') mean(x) std(x) sum(x) sqrt(x) nthroot(x,3) mod(x,3) fact(number or matrix)