Al-Amer 20041 An Introduction to MATLAB Dr. Samir Al-Amer Term 062.

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

Flow Charts, Loop Structures
Al-Amer An Introduction to MATLAB Lesson 2: M-files Dr. Samir Al-Amer Term 061.
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.
EGR 106 – Week 2 – Arrays & Scripts Brief review of last week Arrays: – Concept – Construction – Addressing Scripts and the editor Audio arrays Textbook.
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 18P. 1Winter Quarter Introduction to MATLAB.
General Computer Science for Engineers CISC 106 Lecture 08 Dr. John Cavazos Computer and Information Sciences 2/27/2009.
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.
1 MATLAB 基礎. 2 MATLAB  Workspace: environment (address space) where all variables reside  After carrying out a calculation, MATLAB assigns the result.
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.
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.
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.
Computational Methods of Scientific Programming Lecturers Thomas A Herring, Room A, Chris Hill, Room ,
Introduction to Engineering MATLAB – 6 Script Files - 1 Agenda Script files.
Numerical Computation Lecture 2: Introduction to Matlab Programming United International College.
JAVA Tokens. Introduction A token is an individual element in a program. More than one token can appear in a single line separated by white spaces.
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.
MATLAB Basics. The following screen will appear when you start up Matlab. All of the commands that will be discussed should be typed at the >> prompt.
What is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computation tools. Others include Maple Mathematica MathCad.
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.
Scientific Computing Introduction to Matlab Programming.
Introduction to MATLAB. CSPP58001 MATLAB MATLAB is is a matrix-based language well suited for carrying out numerical analysis. It has many, many high-
ME6104: CAD. Module 4. ME6104: CAD. Module 4. Systems Realization Laboratory Module 4 Matlab ME 6104 – Fundamentals of Computer-Aided Design.
Chapter 1 – Matlab Overview EGR1302. Desktop Command window Current Directory window Command History window Tabs to toggle between Current Directory &
Engineering H192 - Computer Programming Gateway Engineering Education Coalition Lect 18P. 1Winter Quarter Introduction to MATLAB Lecture 18.
INTRODUCTION TO MATLAB MATLAB is a software package for computation in engineering, science, and applied mathemat-ics. It offers a powerful programming.
Introduction to Matlab Module #4 Page 1 Introduction to Matlab Module #4 – Programming Topics 1.Programming Basics (fprintf, standard input) 2.Relational.
Computer Simulation Lab Electrical and Computer Engineering Department SUNY – New Paltz SUNY-New Paltz “Lecture 2”
1 Lecture 1 Post-Graduate Students Advanced Programming (Introduction to MATLAB) Code: ENG 505 Dr. Basheer M. Nasef Computers & Systems Dept.
Lecture 20: Choosing the Right Tool for the Job. What is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computation.
Lecture 26: Reusable Methods: Enviable Sloth. Creating Function M-files User defined functions are stored as M- files To use them, they must be in the.
Digital Image Processing Lecture 6: Introduction to M- function Programming.
Ch13-1 Chap 13 Introduction to Matlab 13.1 Introduction MATLAB : The MATrix LABoratory program Not only is the MATLAB programming language exceptionally.
Digital Image Processing Introduction to M-function Programming.
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.
Matlab for Engineers Matlab Environment Chapter 2.
NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS ( NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS (PRACTICAL PART) Tutorial 2 : Matlab - Getting Started.
Interduction to MATLAB (part 2) Manal Alotaibi Mathematics department College of science King saud university.
Math 252: Math Modeling Eli Goldwyn Introduction to MATLAB.
Chapter 4 MATLAB Programming MATLAB Troubleshooting Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
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.
Basics of MATLAB 2- Programming in MATLAB By DR. Wafaa Shabana
ECE 1304 Introduction to Electrical and Computer Engineering
Matlab Training Session 4: Control, Flow and Functions
Basic operations in Matlab
Scripts & Functions Scripts and functions are contained in .m-files
INTRODUCTION TO BASIC MATLAB
MATLAB DENC 2533 ECADD LAB 9.
Matlab Workshop 9/22/2018.
StatLab Matlab Workshop
Matlab review Matlab is a numerical analysis system
MATLAB (Lecture 2) BY:MAHA ALMOUSA.
CS100J 26 April. Matlab Use help button!!! Variables, values, types
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
INTRODUCTION TO MATLAB
Vectors and Matrices In MATLAB a vector can be defined as row vector or as a column vector. A vector of length n can be visualized as matrix of size 1xn.
Simulation And Modelling
Experiment No. (1) - an introduction to MATLAB
Introduction to MATLAB
MATLAB (Lecture 2) BY:MAHA ALMOUSA.
Presentation transcript:

Al-Amer An Introduction to MATLAB Dr. Samir Al-Amer Term 062

Al-Amer MATLAB It is widely used to solve different types of scientific problems. The basic data structure is a complex double precision matrix. Variable names: Starts with a letter Up to 31 characters ( some use 19 or 21) May contain letters, digits and underscore_ Case sensitive (“A” is not the same as “a”)

Al-Amer Run MATLAB From Start Menu Select Programs Select MATLAB

Al-Amer MATLAB Assignment » A=2.3 A = A=2.3 The MATLAB command » this is the MATLAB prompt. It indicates that MATLAB is ready to accept your command A = This is the result of the MATLAB statement

Al-Amer MATLAB Statements MATLAB Statement Remarks C=5.66 C is a scalar C=[5.66] An alternative way X=[ , 33] X is a 1X3 matrix with elements 3.5, 6.3 and 33. Commas or space are used to separate the elements in a row Y=[1 4 ] Y is a 2X1 matrix whose elements are 1 and 4. Y = [ 1 ; 4] Semicolon are used to indicate the end of the row. A=1:5 Equivalent to A=[ ]

Al-Amer MATLAB Statements MATLAB StatementRemarks V=[ ] C=[1:3:11] C=[ ] Z=4\8 Z=2 Y=eye(2) W = zeros(2,4)

Al-Amer Polynomials roots(p) Find the roots of a polynomial whose coefficients are given in p roots([ ]) Find the roots of x 2 +4x+2.1=0 polyval(p,v) Evaluate the polynomial whose coefficients are given in p at x=v

Al-Amer Help A good idea is use the help help provides information about the available functions and how to use them. Try help eig help inv help roots

Al-Amer Programming in MATLAB There are two types of MATLAB programs % script file P=[1 3 2] roots(P) function [y]=fun(x) y=x^2+3*x^2+2 script files function files

Al-Amer Programming in MATLAB Script files A Script file contains a set of MATLAB command Use them when you have a long sequence of statements to solve a problem Can run the program by typing its name in the command window or from tools in the editor window.

Al-Amer Logical Operators >Greater than >=Greater than or equal <Less than <=Less than or equal ==equal ~=Not equal

Al-Amer Logical Operators &AND |OR ~NOT if (X>6) |(x<3)

Al-Amer If structures General form: If condition statements else statements end If (x>0) sign=1 elseif (x==0) sign=0 else sign=-1 end

Al-Amer for loops General form: for index=initial: increment: limit statements end s=0 for i=1:3:11 s=s+i end

Al-Amer Example MATLAB program to find the roots of % program 1 performs four iterations of % Newton’s Method X=.7 for i=1:4 X=X – (2*cos(X)-1)/(-2*sin(X)) end X = X = X = X = Result