Chapter 6: User defined functions and function files
|
|
- Brent McKinney
- 5 years ago
- Views:
Transcription
1 The Islamic University of Gaza Faculty of Engineering Civil Engineering Department Computer Programming (ECIV 2302) Chapter 6: User defined functions and function files ١
2 6.1 Creating a function file Input data Function File output Function files are created and edited like script files. ٢
3 6.2 Structure of a function file Function definition line The H1 line Help text Function body Assignment of values to output arguments ٣
4 6.2.1 Function Definition Line The first line in a function file must be the function definition line. Defines the file as a function file Defines the name of the function Defines the number and order of the input and output arguments. function [output arguments] = function_name(input arguments) ٤
5 6.2.2 Input and output arguments In order for the function file to work, the output arguments must be assigned values in the computer program that is in the function body. Function definition line function[mpay,tpay] = loan(amount,rate,years) function [A] = RectArea(a,b) function A = RectArea(a,b) function [V,S] = SphereVolArea(r) function trajectory (v,h,g) Comments 3 input arguments, 2 output arguments 2 input arguments, 1 output argument 1 input argument can be typed without brackets. 1 input argument, 2 output variables. 3 input arguments, no output arguments ٥
6 6.2.3 The H1 line and Help text lines They are optional, but used to provide information about the function Function Body The function body contains the code that performs the computation. The code can use all MATLAB features. ٦
7 6.3 Local and Global Variables If you want more than one function to share a single copy of a variable, simply declare the variable as global in all the functions. The global declaration must occur before the variable is actually used in a function. Example: function h = falling(t) global GRAVITY h = 1/2*GRAVITY*t.^2; ٧
8 6.4 Saving a function File A function file must be saved before it can be used. It is recommended that the file is saved with the name that it is identical to the function name in the definition line. Function definition line function[mpay,tpay] = loan(amount,rate,years) function [A] = RectArea(a,b) function A = RectArea(a,b) function [V,S] = SphereVolArea(r) function trajectory (v,h,g) Function name loan.m RectArea.m RectArea.m SphereVol.m Rajectory.m ٨
9 6.5 Using a user defined function Two of the ways that a function can be used: First input argument is loan amount Second input argument is interest rate, And third input argument is the number of years ٩
10 Example 1 ١٠
11 ١١
12 Example 2 ١٢
13 6.7 Comparison between script files and function files M files (both) The first line in a function file is the function definition line. The variables in a function file are local. The variables in a script file are recognized in the command window. Script files can use variables that have been defined in the workspace. Function files can accept data through input arguments and can return data through output arguments. When a function file is saved, the name of the file should be the same as the name of the function. ١٣
14 6.8 Anonymous and inline functions Anonymous function Is a simple (one line) a user defined function that is defined and written within the computer code (not in a separate function file). It can be defined in any part of MATLAB in: Command window Script file Inside user defined functions. (arglist) expr ١٤
15 Examples: >> Cube x^3; >> Circle 16*x^2+9*y^2; >> a, b, and c are defined (assigned numerical values) >> parabola a*x^2+b*x+c Note: anonymous function can include preassigned variables (e.g a, b) ١٥
16 Example (single input argument): ١٦
17 Example (several independent arguments): See Sample problem 6.3 P 168 ١٧
18 6.8.2 Inline Function Note: Name= inline( math expression typed as string ) inline function can not include preassigned variables. ١٨
19 Inline Function has two or more independent variables: Name= inline( math expression typed as string, arg1, arg2, arg3 ) Note: This format shows the order of the arguments to be used when calling the function. If the independent variables are not listed in the command, MATLAB arranges the arguments in alphabetic order. ١٩
20 6.9 Function Functions A (function A) works on uses another function (function B) Using function handles for passing a function into a function function For built-in and user-defined functions: A function handle is created by typing the in front of the function name. For example The function handle can be assigned to a variable name. The next example shows writing a function function that accepts a function handle as an input argument ٢٠
21 1. Passing a user defined function into a function function ٢١
22 ٢٢
23 2. Passing an anonymous function into a function function ٢٣
24 6.9.2 Using a function Name for Passing a Function into a Function By typing the name of the function that is being imported as a string in the input argument of the function. This method for user defined functions. Function handles are easier and more efficient. When a user defined function is imported by using its name, the value of the imported function inside the function function has to be calculated with the feval command. There is a difference in the way that the code in the function function is written that depends on how the imported function is passed in. ٢٤
25 Examples on using the feval command ٢٥
26 1. Writing a function function that accepts a function by typing its name as an input function ٢٦
27 ٢٧
28 6.10 Subfunctions A function file contain more than one user defined function. The functions are typed one after the other. The first function is called the main function and the rest of the functions are called subfunctions. The subfunctions can be typed in any order. The name of the function file correspond the name of the main function. Inside the function file, each of the functions can call any of the other functions. ٢٨
29 Example: Average and standard deviation ٢٩
30 6.11 Nested functions A nested function is a user-defined function that is written inside another user defined function. An end statement is required at the end of all functions. The variables defined in any function can be read and redefined in the rest functions and vise versa. The functions can call each other. One Nested function function y = A(a1,a2).. function z = B(b1,b2) end. end ٣٠
31 Two or more Nested function function y = A(a1,a2).. function z = B(b1,b2) end function w = C(c1,c2) end The three functions can access the workspace of each other. The three functions can call each other.. end ٣١
32 Example: Nested function ٣٢
33 Two levels of nested function function y = A(a1,a2).. function z = B(b1,b2) function w = C(c1,c2) end.. end function u = D(d1,d2) function h = E(e1,e2) end.. end. end A nested function can be called from a level above it. A nested function can be called from a nested function at the same level within a primary function. A nested function can be called from a nested function at any lower level. ٣٣
34 Problem 6.5 ٣٤
35 Problem 6.10 ٣٥
36 Problem 6.21 ٣٦
37 Example Given: An object thrown vertically with a speed v 0 reaches a height h at time t where: 1 h v0t gt 2 Required Write a function to compute h given v 0 and t. It should allow t to be a vector. Use the function to PLOT h versus t for t between 0 and 10s and v 0 = 50 m/s. 2
38
39
y = f (x) f(x) MATLAB MATLAB - Lecture # 7 Functions and Function Files / Chapter Function File
MATLAB - Lecture # 7 Functions and Function Files / Chapter 6 Topics Covered: 1. Function files. A FUNCTION y = f (x) A function f (x) associates a unique number y to each value of x. For example, if y
More informationENGR 1181 MATLAB 15: Functions 2
ENGR 1181 MATLAB 15: Functions 2 Learning Objectives 1. Integrate user-written functions into the same file with the main program 2. Identify good function conventions, (e.g., the importance of placing
More informationComputer Programming ECIV 2303 Chapter 1 Starting with MATLAB Instructor: Dr. Talal Skaik Islamic University of Gaza Faculty of Engineering
Computer Programming ECIV 2303 Chapter 1 Starting with MATLAB Instructor: Dr. Talal Skaik Islamic University of Gaza Faculty of Engineering 1 Introduction 2 Chapter l Starting with MATLAB This chapter
More informationComputer Programming: C++
The Islamic University of Gaza Engineering Faculty Department of Computer Engineering Fall 2017 ECOM 2003 Muath i.alnabris Computer Programming: C++ Experiment #7 Arrays Part II Passing Array to a Function
More informationChapter 7: Programming in MATLAB
The Islamic University of Gaza Faculty of Engineering Civil Engineering Department Computer Programming (ECIV 2302) Chapter 7: Programming in MATLAB 1 7.1 Relational and Logical Operators == Equal to ~=
More informationINTRODUCTION TO NUMERICAL ANALYSIS
INTRODUCTION TO NUMERICAL ANALYSIS Cho, Hyoung Kyu Department of Nuclear Engineering Seoul National University 0. MATLAB USAGE 1. Background MATLAB MATrix LABoratory Mathematical computations, modeling
More informationFondamenti di Informatica
Fondamenti di Informatica Scripts and Functions lesson 8 2012/04/12 Prof. Emiliano Casalicchio emiliano.casalicchio@uniroma2.it Agenda n Matlab scripts examples n Matlab functions differences with script
More informationChapter 3: Programming with MATLAB
Chapter 3: Programming with MATLAB Choi Hae Jin Chapter Objectives q Learning how to create well-documented M-files in the edit window and invoke them from the command window. q Understanding how script
More informationUser Defined Functions
User Defined Functions Aaron S. Donahue Department of Civil and Environmental Engineering and Earth Sciences University of Notre Dame February 27, 2013 CE20140 A. S. Donahue (University of Notre Dame)
More informationCOMPUTER SKILLS LESSON 12. Valeria Cardellini A.Y. 2015/16
COMPUTER SKILLS LESSON 12 Valeria Cardellini cardellini@ing.uniroma2.it A.Y. 2015/16 11/25/15 Computer Skills - Lesson 12 - V. Cardellini 2 Objectives of this lesson We ll discuss Functions that return
More informationComputer Programming ECIV 2303 Chapter 6 Programming in MATLAB Instructor: Dr. Talal Skaik Islamic University of Gaza Faculty of Engineering
Computer Programming ECIV 2303 Chapter 6 Programming in MATLAB Instructor: Dr. Talal Skaik Islamic University of Gaza Faculty of Engineering 1 Introduction A computer program is a sequence of computer
More informationUser Defined Functions
User Defined Functions 120 90 1 0.8 60 Chapter 6 150 0.6 0.4 30 0.2 180 0 210 330 240 270 300 Objectives Create and use MATLAB functions with both single and multiple inputs and outputs Learn how to store
More informationECE 102 Engineering Computation
ECE 102 Engineering Computation Phillip Wong MATLAB Function Files Nested Functions Subfunctions Inline Functions Anonymous Functions Function Files A basic function file contains one or more function
More informationChapter 4: Programming with MATLAB
Chapter 4: Programming with MATLAB Topics Covered: Programming Overview Relational Operators and Logical Variables Logical Operators and Functions Conditional Statements For Loops While Loops Debugging
More informationSorting. Introduction. Classification
Sorting Introduction In many applications it is necessary to order give objects as per an attribute. For example, arranging a list of student information in increasing order of their roll numbers or arranging
More informationChapter 3 Functions and Files
Chapter 3 Functions and Files Getting Help for Functions You can use the lookfor command to find functions that are relevant to your application. For example, type lookfor imaginary to get a list of the
More informationSECTION 2: PROGRAMMING WITH MATLAB. MAE 4020/5020 Numerical Methods with MATLAB
SECTION 2: PROGRAMMING WITH MATLAB MAE 4020/5020 Numerical Methods with MATLAB 2 Functions and M Files M Files 3 Script file so called due to.m filename extension Contains a series of MATLAB commands The
More informationPART 2 DEVELOPING M-FILES
PART 2 DEVELOPING M-FILES Presenter: Dr. Zalilah Sharer 2018 School of Chemical and Energy Engineering Universiti Teknologi Malaysia 17 September 2018 Topic Outcomes Week Topic Topic Outcomes 6-8 Creating
More informationIntroduction to Python
Islamic University Of Gaza Faculty of Engineering Computer Engineering Department Lab 1 Introduction to Python Eng. Ibraheem Lubbad September 17, 2016 Introduction: Python is a high-level, object-oriented
More information1 >> Lecture 3 2 >> 3 >> -- Functions 4 >> Zheng-Liang Lu 172 / 225
1 >> Lecture 3 2 >> 3 >> -- Functions 4 >> Zheng-Liang Lu 172 / 225 Functions The first thing of the design of algorithms is to divide and conquer. A large and complex problem would be solved by couples
More informationApproximations and Errors
The Islamic University of Gaza Faculty of Engineering Civil Engineering Department Numerical Analysis ECIV 3306 Chapter 3 Approximations and Errors Associate Prof. Mazen Abualtayef Civil Engineering Department,
More informationDSP Laboratory (EELE 4110) Lab#1 Introduction to Matlab
Islamic University of Gaza Faculty of Engineering Electrical Engineering Department 2012 DSP Laboratory (EELE 4110) Lab#1 Introduction to Matlab Goals for this Lab Assignment: In this lab we would have
More information1 >> Lecture 3 2 >> 3 >> -- Functions 4 >> Zheng-Liang Lu 169 / 221
1 >> Lecture 3 2 >> 3 >> -- Functions 4 >> Zheng-Liang Lu 169 / 221 Functions Recall that an algorithm is a feasible solution to the specific problem. 1 A function is a piece of computer code that accepts
More informationEGR 111 Functions and Relational Operators
EGR 111 Functions and Relational Operators This lab is an introduction to writing your own MATLAB functions. The lab also introduces relational operators and logical operators which allows MATLAB to compare
More informationIntroduction to MATLAB 7 for Engineers
PowerPoint to accompany Introduction to MATLAB 7 for Engineers William J. Palm III Chapter 3 Functions and Files Copyright 2005. The McGraw-Hill Companies, Inc. Permission required for reproduction or
More information4.0 Programming with MATLAB
4.0 Programming with MATLAB 4.1 M-files The term M-file is obtained from the fact that such files are stored with.m extension. M-files are alternative means of performing computations so as to expand MATLAB
More informationLEARNING TO PROGRAM WITH MATLAB. Building GUI Tools. Wiley. University of Notre Dame. Craig S. Lent Department of Electrical Engineering
LEARNING TO PROGRAM WITH MATLAB Building GUI Tools Craig S. Lent Department of Electrical Engineering University of Notre Dame Wiley Contents Preface ix I MATLAB Programming 1 1 Getting Started 3 1.1 Running
More informationScope of Variables. In general, it is not a good practice to define many global variables. 1. Use global to declare x as a global variable.
Scope of Variables The variables used in function m-files are known as local variables. Any variable defined within the function exists only for the function to use. The only way a function can communicate
More informationChapter 3: Functions and Files
Topics Covered: Chapter 3: Functions and Files Built-In Functions Mathematical Functions User-Defined Functions Function Files Anonymous Functions Function Functions Function Handles Working with Data
More informationChapters 6-7. User-Defined Functions
Chapters 6-7 User-Defined Functions User-Defined Functions, Iteration, and Debugging Strategies Learning objectives: 1. Write simple program modules to implement single numerical methods and algorithms
More informationIntroductory MATLAB. Appendix A A.1 BACKGROUND A.2 STARTING WITH MATLAB. Core Topics
Appendix A Introductory MATLAB Core Topics Starting with MATLAB (A.2). Arrays (A.3). Mathematical operations with arrays (A.4). Script files (A.5). User-defined functions and function files (A.7). Anonymous
More informationMATLAB - FUNCTIONS. Functions can accept more than one input arguments and may return more than one output arguments.
MATLAB - FUNCTIONS http://www.tutorialspoint.com/matlab/matlab_functions.htm Copyright tutorialspoint.com A function is a group of statements that together perform a task. In MATLAB, functions are defined
More informationLesson 3.1 Vertices and Intercepts. Important Features of Parabolas
Lesson 3.1 Vertices and Intercepts Name: _ Learning Objective: Students will be able to identify the vertex and intercepts of a parabola from its equation. CCSS.MATH.CONTENT.HSF.IF.C.7.A Graph linear and
More informationIntroduction to MATLAB Programming
Spring 2019 Spring 2019 1 / 17 Introduction Algorithm An algorithm is a sequence of steps needed to solve a problem. We will use MATLAB to develop algorithms to solve specific problems. The basic algorithm
More informationWhat is a Function? EF102 - Spring, A&S Lecture 4 Matlab Functions
What is a Function? EF102 - Spring, 2002 A&S Lecture 4 Matlab Functions What is a M-file? Matlab Building Blocks Matlab commands Built-in commands (if, for, ) Built-in functions sin, cos, max, min Matlab
More informationIntroduction to MATLAB for Engineers, Third Edition
PowerPoint to accompany Introduction to MATLAB for Engineers, Third Edition William J. Palm III Chapter 3 Functions and Files Copyright 2010. The McGraw-Hill Companies, Inc. 3-2 Getting Help for Functions
More informationTentative Course Schedule, CRN INTRODUCTION TO SCIENTIFIC & ENGINEERING COMPUTING BIL 108E, CRN24023 LECTURE # 5 INLINE FUNCTIONS
Tentative Course Schedule, CRN 24023 INTRODUCTION TO SCIENTIFIC & ENGINEERING COMPUTING BIL 108E, CRN24023 Dr. S. Gökhan Technical University of Istanbul Week Date Topics 1 Feb. 08 Computing 2 Feb. 15
More informationCreates a 1 X 1 matrix (scalar) with a value of 1 in the column 1, row 1 position and prints the matrix aaa in the command window.
EE 350L: Signals and Transforms Lab Spring 2007 Lab #1 - Introduction to MATLAB Lab Handout Matlab Software: Matlab will be the analytical tool used in the signals lab. The laboratory has network licenses
More informationLecture 4: Complex Numbers Functions, and Data Input
Lecture 4: Complex Numbers Functions, and Data Input Dr. Mohammed Hawa Electrical Engineering Department University of Jordan EE201: Computer Applications. See Textbook Chapter 3. What is a Function? A
More informationFUNCTIONS ( WEEK 5 ) DR. USMAN ULLAH SHEIKH DR. MUSA MOHD MOKJI DR. MICHAEL TAN LONG PENG DR. AMIRJAN NAWABJAN DR. MOHD ADIB SARIJARI
FUNCTIONS SKEE1022 SCIENTIFIC PROGRAMMING ( WEEK 5 ) DR. USMAN ULLAH SHEIKH DR. MUSA MOHD MOKJI DR. MICHAEL TAN LONG PENG DR. AMIRJAN NAWABJAN DR. MOHD ADIB SARIJARI OBJECTIVES Create Function 1) Create
More informationPrecalculus 2 Section 10.6 Parametric Equations
Precalculus 2 Section 10.6 Parametric Equations Parametric Equations Write parametric equations. Graph parametric equations. Determine an equivalent rectangular equation for parametric equations. Determine
More informationStatistical Programming with R
Statistical Programming with R Lecture 5: Simple Programming Bisher M. Iqelan biqelan@iugaza.edu.ps Department of Mathematics, Faculty of Science, The Islamic University of Gaza 2017-2018, Semester 1 Functions
More informationQuestion Points Score Total 100
Name Signature General instructions: You may not ask questions during the test. If you believe that there is something wrong with a question, write down what you think the question is trying to ask and
More informationUsing the Grade Upload Feature in Faculty Center
Using the Grade Upload Feature in Faculty Center Updated 05/12/2017 Use the Grade Upload feature to import multiple grades to a grade roster from a spreadsheet (.CSV file). Grade Upload can now be used
More informationEGR 111 Functions and Relational Operators
EGR 111 Functions and Relational Operators This lab is an introduction to writing your own MATLAB functions. The lab also introduces relational operators and logical operators which allows MATLAB to compare
More informationEVAL FUNCTION. eval Execute a string containing a MATLAB expression
EVAL FUNCTION eval Execute a string containing a MATLAB expression Syntax The eval command is one of the most powerful and flexible commands in MATLAB. eval is short for evaluate, which is exactly what
More informationSIGNALS AND LINEAR SYSTEMS LABORATORY EELE
The Islamic University of Gaza Faculty of Engineering Electrical Engineering Department SIGNALS AND LINEAR SYSTEMS LABORATORY EELE 3110 Experiment (5): Simulink Prepared by: Eng. Mohammed S. Abuwarda Eng.
More informationXML Technologies XML, DTD
XML Technologies XML, DTD Basic Structural Components of XML Documents (1/2)
More informationMatlab Tutorial 1: Working with variables, arrays, and plotting
Matlab Tutorial 1: Working with variables, arrays, and plotting Setting up Matlab First of all, let's make sure we all have the same layout of the different windows in Matlab. Go to Home Layout Default.
More informationTable of Contents. Introduction.*.. 7. Part /: Getting Started With MATLAB 5. Chapter 1: Introducing MATLAB and Its Many Uses 7
MATLAB Table of Contents Introduction.*.. 7 About This Book 1 Foolish Assumptions 2 Icons Used in This Book 3 Beyond the Book 3 Where to Go from Here 4 Part /: Getting Started With MATLAB 5 Chapter 1:
More informationJAVA PROGRAMMING LAB. ABSTRACT In this Lab you will learn how to describe objects and classes and how to define classes and create objects
Islamic University of Gaza Faculty of Engineering Computer Engineering Dept Computer Programming Lab (ECOM 2114) ABSTRACT In this Lab you will learn how to describe objects and classes and how to define
More informationLecture 6 MATLAB programming (4) Dr.Qi Ying
Lecture 6 MATLAB programming (4) Dr.Qi Ying Objectives User-defined Functions Anonymous Functions Function name as an input argument Subfunctions and nested functions Arguments persistent variable Anonymous
More informationMatlab Advanced Programming. Matt Wyant University of Washington
Matlab Advanced Programming Matt Wyant University of Washington Matlab as a programming Language Strengths (as compared to C/C++/Fortran) Fast to write -no type declarations needed Memory allocation/deallocation
More informationCOGS 119/219 MATLAB for Experimental Research. Fall Functions
COGS 119/219 MATLAB for Experimental Research Fall 2016 - Functions User-defined Functions A user-defined function is a MATLAB program that is created by a user, saved as a function file, and then can
More informationLecture 10 Declarations and Scope
Lecture 10 Declarations and Scope Declarations and Scope We have seen numerous qualifiers when defining methods and variables public private static final (we'll talk about protected when formally addressing
More informationUser-defined Functions
User-defined Functions >> x = 19; >> y = sqrt (x); sqrt is a built-in function Somewhere there is a file called sqrt.m that contains all the code to compute sine It would be a pain to write that yourself
More informationComputer Programming, I. Laboratory Manual. Final Exam Solution
Think Twice Code Once The Islamic University of Gaza Engineering Faculty Department of Computer Engineering Fall 2017 ECOM 2005 Khaleel I. Shaheen Computer Programming, I Laboratory Manual Final Exam Solution
More informationFaculty of Engineering Computer Engineering Department Islamic University of Gaza Network Lab # 5 Managing Groups
Faculty of Engineering Computer Engineering Department Islamic University of Gaza 2012 Network Lab # 5 Managing Groups Network Lab # 5 Managing Groups Objective: Learn about groups and where to create
More informationComputer Programming: C++
The Islamic University of Gaza Engineering Faculty Department of Computer Engineering Fall 2017 ECOM 2003 Muath i.alnabris Computer Programming: C++ Experiment #3 Loops Part I Contents Introduction For-Loop
More informationArrays. Comp Sci 1570 Introduction to C++ Array basics. arrays. Arrays as parameters to functions. Sorting arrays. Random stuff
and Arrays Comp Sci 1570 Introduction to C++ Outline and 1 2 Multi-dimensional and 3 4 5 Outline and 1 2 Multi-dimensional and 3 4 5 Array declaration and An array is a series of elements of the same type
More informationAn Introduction to MATLAB
An Introduction to MATLAB Day 1 Simon Mitchell Simon.Mitchell@ucla.edu High level language Programing language and development environment Built-in development tools Numerical manipulation Plotting of
More informationApplications of Structures (1A) Young Won Lim 12/8/17
Applications of (1A) Copyright (c) 2009-2017 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any
More informationST512. Fall Quarter, Exam 1. Directions: Answer questions as directed. Please show work. For true/false questions, circle either true or false.
ST512 Fall Quarter, 2005 Exam 1 Name: Directions: Answer questions as directed. Please show work. For true/false questions, circle either true or false. 1. (42 points) A random sample of n = 30 NBA basketball
More informationA Guide to Using Some Basic MATLAB Functions
A Guide to Using Some Basic MATLAB Functions UNC Charlotte Robert W. Cox This document provides a brief overview of some of the essential MATLAB functionality. More thorough descriptions are available
More informationMATLAB Lecture 4. Programming in MATLAB
MATLAB Lecture 4. Programming in MATLAB In this lecture we will see how to write scripts and functions. Scripts are sequences of MATLAB statements stored in a file. Using conditional statements (if-then-else)
More informationSimulationstechnik. Fachhochschule Heilbronn Automotive System Engineering. Simulationstechnik. L-3 Matlab.m files. Dr. Tröster ASE 5.
Fachhochschule Heilbronn Automotive System Engineering Simulationstechnik L-3 Matlab.m files Dr. Tröster ASE 5 1 Matlab The philosophy of Matlab m files from the simulation point of view What tools do
More informationConstraint-based Metabolic Reconstructions & Analysis H. Scott Hinton. Matlab Tutorial. Lesson: Matlab Tutorial
1 Matlab Tutorial 2 Lecture Learning Objectives Each student should be able to: Describe the Matlab desktop Explain the basic use of Matlab variables Explain the basic use of Matlab scripts Explain the
More informationProgramming in MATLAB
trevor.spiteri@um.edu.mt http://staff.um.edu.mt/trevor.spiteri Department of Communications and Computer Engineering Faculty of Information and Communication Technology University of Malta 17 February,
More informationList Comprehensions. Function Definitions. This is the same as mapping the doubling function on the list [1,2,3], but without an explicit
List Comprehensions Python provides an elegant mechanism for building a list by embedding a for within list brackets. This a termed a List Comprehension. The general form is an expression, followed by
More informationAMATH 352: MATLAB Tutorial written by Peter Blossey Department of Applied Mathematics University of Washington Seattle, WA
AMATH 352: MATLAB Tutorial written by Peter Blossey Department of Applied Mathematics University of Washington Seattle, WA MATLAB (short for MATrix LABoratory) is a very useful piece of software for numerical
More informationVisualization of Biomolecular Structures
T H E U N I V E R S I T Y of T E X A S H E A L T H S C I E N C E C E N T E R A T H O U S T O N S C H O O L of H E A L T H I N F O R M A T I O N S C I E N C E S Visualization of Biomolecular Structures
More informationRoot Locus Controller Design
Islamic University of Gaza Faculty of Engineering Electrical Engineering department Control Systems Design Lab Eng. Mohammed S. Jouda Eng. Ola M. Skeik Experiment 4 Root Locus Controller Design Overview
More informationEE 350. Continuous-Time Linear Systems. Recitation 1. 1
EE 350 Continuous-Time Linear Systems Recitation 1 Recitation 1. 1 Recitation 1 Topics MATLAB Programming Basic Operations, Built-In Functions, and Variables m-files Graphics: 2D plots EE 210 Review Branch
More informationIntroduction to MATLAB LAB 1
Introduction to MATLAB LAB 1 1 Basics of MATLAB MATrix LABoratory A super-powerful graphing calculator Matrix based numeric computation Embedded Functions Also a programming language User defined functions
More informationActual Major League Baseball Salaries ( )
Chapter 2: Organizing and Presenting Data (Page 31) Why do we use graphs? Organize Summarize Analyze Data In a nutshell, Graphs make it easier to: understand describe what is going on with the data Definition
More information+. n is the function parameter and the function returns the sum.
CS/INFO 1305 Programming Exercise 2 Due Wednesday, July 22, at 10pm Submit either Level 1 or Level 2. For Level 2, problem 2.3 is required; complete ONE of 2.1 and 2.2. 1 Level 1 1. During the previous
More informationProgramming Language. Control Structures: Selection (switch) Eng. Anis Nazer First Semester
Programming Language Control Structures: Selection (switch) Eng. Anis Nazer First Semester 2018-2019 Multiple selection choose one of two things if/else choose one from many things multiple selection using
More informationIntroduction to Fortran Programming. -External subprograms-
Introduction to Fortran Programming -External subprograms- Subprograms Subprograms are used to split a program into separate smaller units. Internal subprograms are dependent parts of a program. Fortran
More informationTcl/Tk lecture. What is the Wish Interpreter? CIS 410/510 User Interface Programming
Tcl/Tk lecture CIS 410/510 User Interface Programming Tool Command Language TCL Scripting language for developing & using GUIs Allows generic programming variables, loops, procedures Embeddable into an
More informationApplications of Structures (1A) Young Won Lim 12/4/17
Applications of (1A) Copyright (c) 2009-2017 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any
More informationIntroduction to MATLAB programming: Fundamentals
Introduction to MATLAB programming: Fundamentals Shan He School for Computational Science University of Birmingham Module 06-23836: Computational Modelling with MATLAB Outline Outline of Topics Why MATLAB?
More informationME 1020 Engineering Programming with MATLAB. Chapter 1 In-Class Assignment: 1.1, 1.3, 1.13, Topics Covered:
ME 1020 Engineering Programming with MATLAB Chapter 1 In-Class Assignment: 1.1, 1.3, 1.13, 1.16 Topics Covered: Use MATLAB as a calculator Save files to folders and open files from folders Create row vector
More informationWorking with Microsoft Excel. Touring Excel. Selecting Data. Presented by: Brian Pearson
Working with Microsoft Excel Presented by: Brian Pearson Touring Excel Menu bar Name box Formula bar Ask a Question box Standard and Formatting toolbars sharing one row Work Area Status bar Task Pane 2
More informationFDP on Electronic Design Tools - Computing with MATLAB 13/12/2017. A hands-on training session on. Computing with MATLAB
A hands-on training session on Computing with MATLAB in connection with the FDP on Electronic Design Tools @ GCE Kannur 11 th 15 th December 2017 Resource Person : Dr. A. Ranjith Ram Associate Professor,
More informationIntroduction to programming in MATLAB
Master Degree Course in ELECTRONICS ENGINEERING http://www.dii.unimore.it/~lbiagiotti/systemscontroltheory.html Introduction to programming in MATLAB e-mail: luigi.biagiotti@unimore.it http://www.dii.unimore.it/~lbiagiotti
More informationFaculty of Engineering Computer Engineering Department Islamic University of Gaza C++ Programming Language Lab # 6 Functions
Faculty of Engineering Computer Engineering Department Islamic University of Gaza 2013 C++ Programming Language Lab # 6 Functions C++ Programming Language Lab # 6 Functions Objective: To be familiar with
More informationPART 1 PROGRAMMING WITH MATHLAB
PART 1 PROGRAMMING WITH MATHLAB Presenter: Dr. Zalilah Sharer 2018 School of Chemical and Energy Engineering Universiti Teknologi Malaysia 23 September 2018 Programming with MATHLAB MATLAB Environment
More informationSample: Do Not Reproduce QUAD4 STUDENT PAGES. QUADRATIC FUNCTIONS AND EQUATIONS Student Pages for Packet 4: Quadratic Functions and Applications
Name Period Date QUADRATIC FUNCTIONS AND EQUATIONS Student Pages for Packet 4: Quadratic Functions and Applications QUAD 4.1 Vertex Form of a Quadratic Function 1 Explore how changing the values of h and
More informationIterator: A way to sequentially access ( traverse ) each object in a container or collection. - Access is done as needed, not necessarily at once.
CSE 12, Week Seven, Lecture One Iterator: A way to sequentially access ( traverse ) each object in a container or collection - Access is done as needed, not necessarily at once. - Implemented by a private
More informationEng Marine Production Management. Introduction to Matlab
Eng. 4061 Marine Production Management Introduction to Matlab What is Matlab? Matlab is a commercial "Matrix Laboratory" package which operates as an interactive programming environment. Matlab is available
More informationComputational Finance
Computational Finance Introduction to Matlab Marek Kolman Matlab program/programming language for technical computing particularly for numerical issues works on matrix/vector basis usually used for functional
More informationRECTILINEAR MOVEMENT
RECTILINEAR MOVEMENT This teaching unit continues the study of movement which we began in these two previous units: Moving bodies and Trajectory and Displacement In this one we look separately at Uniform
More informationCSE 12, Week Six, Lecture Two Discussion: Getting started on hw7 & hw8
CSE 12, Week Six, Lecture Two Discussion: Getting started on hw7 & hw8 Tree: What: - A container object - Composed of a TNodes o Each TNode holds - One root TNode pointer o The TNode in the Tree - Zero
More informationMATLAB GUIDE UMD PHYS401 SPRING 2012
MATLAB GUIDE UMD PHYS40 SPRING 202 We will be using Matlab (or, equivalently, the free clone GNU/Octave) this semester to perform calculations involving matrices and vectors. This guide gives a brief introduction
More informationComputer Programming: C++
The Islamic University of Gaza Engineering Faculty Department of Computer Engineering Fall 2017 ECOM 2003 Muath i.alnabris Computer Programming: C++ Experiment #4 Loops Part II Contents Loop Control Statement
More informationChapter 3: Introduction to MATLAB Programming (4 th ed.)
Chapter 3: Introduction to MATLAB Programming (4 th ed.) Algorithms MATLAB scripts Input / Output o disp versus fprintf Graphs Read and write variables (.mat files) User-defined Functions o Definition
More information6 Appendix B: Quick Guide to MATLAB R
6 Appendix B: Quick Guide to MATLAB R 6.1 Introduction In this course we will be using the software package MATLAB R. Version 17.12.0, Release R2011a has been installed in Foster 100, the labs on the third
More informationPage 1 of 7 E7 Spring 2009 Midterm I SID: UNIVERSITY OF CALIFORNIA, BERKELEY Department of Civil and Environmental Engineering. Practice Midterm 01
Page 1 of E Spring Midterm I SID: UNIVERSITY OF CALIFORNIA, BERKELEY Practice Midterm 1 minutes pts Question Points Grade 1 4 3 6 4 16 6 1 Total Notes (a) Write your name and your SID on the top right
More informationRun Menu. Order of Operations. Example: x Enter the expression as it appears and press [EXE]
Run Menu With manual calculations, input formulas from left to right, just as they are written on paper. With formulas that include mixed arithmetic operators and parentheses, the calculator automatically
More informationBefore we jump to functions and scripts, we will cover two examples: the first from personal finances and the second from physics.
Chapter 1 Functions, scripts and good programming practice The art of programming is the ability to translate from human notation to one which a computer understands. In the spirit of gradual increase
More information