1 Ch 9-10 lSubsetting lOrdering lArray operations lIteration © Fall 2004 Don Edwards and the University of South Carolina.

Slides:



Advertisements
Similar presentations
Programming Tips: While Loops and Comparisons 1Daniel Baur / Numerical Methods for Chemical Engineerse Daniel Baur ETH Zurich, Institut für Chemie- und.
Advertisements

Chapter 8. Data Structure: A variable that stores more than one value Matrices/vectors and character arrays are types of data structures MATLAB also provides.
COMP 116: Introduction to Scientific Programming Lecture 37: Final Review.
Introduction to arrays
Introduction to Matlab
MATLAB – What is it? Computing environment / programming language Tool for manipulating matrices Many applications, you just need to get some numbers in.
Basics of R, Ch  Functions  Help  Managing your Objects  Getting Data into R  Getting Results out of R 1 © Fall 2004 Don Edwards and the University.
Maths for Computer Graphics
Lecture 5 Review Programming Program Structures Comparison Repetition: looping or iteration Conditional execution: branching Bubble Sort.
1 Ch 7-8 lArithmetic lLogical Operators © Fall 2004 Don Edwards and the University of South Carolina.
Binary Search Visualization i j.
Tutorial 12 Working with Arrays, Loops, and Conditional Statements
1 Basics of R, Ch lFunctions lHelp lManaging your Objects lGetting Data into R lGetting Results out of R © Fall 2004 Don Edwards and the University.
1 Ch 11 Graphics lManaging graphics windows l1-d, 2-d and 3-d plotting lInteractive graphics © Fall 2004 Don Edwards and the University of South Carolina.
Lecture 7 Sept 19, 11 Goals: two-dimensional arrays (continued) matrix operations circuit analysis using Matlab image processing – simple examples Chapter.
Fall 2008 Insertion Sort – review of loop invariants.
Lecture 6 Sept 15, 09 Goals: two-dimensional arrays matrix operations circuit analysis using Matlab image processing – simple examples.
Two Dimensional Arrays. One dimension Rank 1 Array INTEGER, DIMENSION (3) :: a Row 1 Row 2 Row 3.
MATLAB Basic. Basic Data Elements The basic elements that MATLAB uses are matrices To form a matrix: Enter : A=[ ; ; ;
1 Ch 12 Function writing lInputting functions lFunction writing examples lPooled t-test lPlotting © Fall 2004 Don Edwards and the University of South Carolina.
1 Statistics 517 Computing in Statistics © Fall 2004 Don Edwards and the University of South Carolina.
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.
Selection Sort
C ENTER FOR I NTEGRATED R ESEARCH C OMPUTING MATLAB
Arrays. What is an Array? Similar to a Matrix. Collection of data that needs similar processing. Example: Transpose of a matrix.
Value Iteration 0: step 0. Insertion Sort Array index67 Iteration i. Repeatedly swap element i with.
1 © 2012 The MathWorks, Inc. Speeding up MATLAB Applications.
Chapter 5. Loops are common in most programming languages Plus side: Are very fast (in other languages) & easy to understand Negative side: Require a.
Nonparametric Econometrics1 Intro to Matlab for Data Analysis and Statistical Modeling.
For Loops 2 ENGR 1181 MATLAB 9. For Loops and Looped Programming in Real Life As first introduced last lecture, looping within programs has long been.
REVIEW 2 Exam History of Computers 1. CPU stands for _______________________. a. Counter productive units b. Central processing unit c. Copper.
For Loops 1 ENGR 1181 MATLAB 8. For Loops and Looped Programming in Real Life Looping within programs has long been a useful tool for completing mundane.
Traversing an array 1.Definition 2.Use the for loop 3.Some new functions 4.Use the while loop 1.
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.
Matlab Programming for Engineers Dr. Bashir NOURI Introduction to Matlab Matlab Basics Branching Statements Loops User Defined Functions Additional Data.
What does C store? >>A = [1 2 3] >>B = [1 1] >>[C,D]=meshgrid(A,B) c) a) d) b)
Bubble Sort 18 th December 2014 With Mrs
INTRODUCTION SELECTION STATEMENTS -Control Expression -Single/Compound Clauses -Dangling Else MUTLIPLE SELECTION CONSTRUCTS -C/Java Switch -C# Switch -Ada.
Example of programming a quantum robot This program can be easily changed to the following types of control: 1.Boolean Logic 2.Fuzzy logic 3.Probabilistic.
read and learn from example loop programs develop modular program
Selection Sort
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.
5-1 Logic System Design I VHDL Design Principles ECGR2181 Reading: Chapter 5.0, 5.1, 5.3 port ( I: in STD_LOGIC_VECTOR (1 to 9); EVEN, ODD: out STD_LOGIC.
1.7 Linear Independence. in R n is said to be linearly independent if has only the trivial solution. in R n is said to be linearly dependent if there.
S-PLUS Lecture 4 Jaeyong Lee Pennsylvania State University.
Improving Matlab Performance CS1114
Math 252: Math Modeling Eli Goldwyn Introduction to MATLAB.
Finishing up Chapter 5. Will this code enter the if statement? G=[30,55,10] if G
CIS 595 MATLAB First Impressions. MATLAB This introduction will give Some basic ideas Main advantages and drawbacks compared to other languages.
= the matrix for T relative to the standard basis is a basis for R 2. B is the matrix for T relative to To find B, complete:
Notes Over 4.2 Finding the Product of Two Matrices Find the product. If it is not defined, state the reason. To multiply matrices, the number of columns.
Do Now: Perform the indicated operation. 1.). Algebra II Elements 11.1: Matrix Operations HW: HW: p.590 (16-36 even, 37, 44, 46)
Click to edit Master title style Click to edit Master text styles –Second level Third level –Fourth level »Fifth level 1 Fundamentals of Programming Most.
Control Structures Hara URL:
13.4 Product of Two Matrices
Ch 11 Graphics Managing graphics windows 1-d, 2-d and 3-d plotting
Ch 7-8 Arithmetic Logical Operators
Trails Carolina
Therapy Programs Provider: Trails Carolina
Trails Carolina: Social Media Profiles
Example of programming a quantum robot
Introduction to MATLAB
Use of Mathematics using Technology (Maltlab)
CSCI N207 Data Analysis Using Spreadsheet
Statistics 540 Computing in Statistics
Basics of R, Ch Functions Help Managing your Objects
Ch 9-10 Subsetting Ordering Array operations Iteration
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 Modeling
2-Dimensional Lists (Matrices) in Python
Presentation transcript:

1 Ch 9-10 lSubsetting lOrdering lArray operations lIteration © Fall 2004 Don Edwards and the University of South Carolina

2 9 Subsetting and sorting lExtraction with “[]” for vectors and matrices l: and c() lRows, columns, and sub-matrices lIndices are not extracted lExtraction with logical vectors lStatements look self-referential

3 9 Subsetting and sorting lOrder function lCreates vector of indices that can then be used to “extract” ordered data files lLike a logical vector, the focus is on the index object, not the output object lSort function lacks functionality

4 10 Matrix operations lSplus was very inefficient at looping lR is improved lBoth Splus and R have built-in iterative capabilities lFunctions that operate on vectors and arrays lThe apply() function ltapply() works on groups

5 10 Matrix operations lIf we need to iterate, we use for() and while() statements lfor() uses a counter lwhile() uses a logical comparison lIf for() is slow, R can call both C++ and Fortran subroutines