REVIEW 2 Exam 3 1. 1.History of Computers 1. CPU stands for _______________________. a. Counter productive units b. Central processing unit c. Copper.

Slides:



Advertisements
Similar presentations
Introduction to MATLAB The language of Technical Computing.
Advertisements

Introduction to arrays
Introduction to Matlab
1 EMT 101 – Engineering Programming Dr. Farzad Ismail School of Aerospace Engineering Universiti Sains Malaysia Nibong Tebal Pulau Pinang Week 10.
M AT L AB Programming: scripts & functions. Scripts It is possible to achieve a lot simply by executing one command at a time on the command line (even.
Introduction to MATLAB for Biomedical Engineering BME 1008 Introduction to Biomedical Engineering FIU, Spring 2015 Lesson 2: Element-wise vs. matrix operations.
Introduction to MATLAB
Week 6 - Programming I So far, we’ve looked at simple programming via “scripts” = programs of sequentially evaluated commands Today, extend features to:
Loops – While, Do, For Repetition Statements Introduction to 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.
JavaScript, Fourth Edition
VB .NET Programming Fundamentals
Programming Concepts MIT - AITI. Variables l A variable is a name associated with a piece of data l Variables allow you to store and manipulate data in.
EPSII 59:006 Spring Topics Using TextPad If Statements Relational Operators Nested If Statements Else and Elseif Clauses Logical Functions For Loops.
Chapter 4 MATLAB Programming Combining Loops and Logic Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
MATLAB and SimulinkLecture 11 To days Outline  Introduction  MATLAB Desktop  Basic Features  Branching Statements  Loops  Script file / Commando.
Exam 1: Review 1.History of computers 2.Fundamentals of computer architecture 3.Developing algorithms and programs 4.Variables and data types 5.User I/O.
MATLAB INTRO CONTROL LAB1  The Environment  The command prompt Getting Help : e.g help sin, lookfor cos Variables Vectors, Matrices, and Linear Algebra.
Introduction to MATLAB
Operator Precedence First the contents of all parentheses are evaluated beginning with the innermost set of parenthesis. Second all multiplications, divisions,
Exam 3: Review (part 1) 1. Test 1 - Outcomes Computers & Solutions 1)Understand the basic concepts of a computer: the hardware, the software, the different.
WEEK 3 AND 4 USING CLIENT-SIDE SCRIPTS TO ENHANCE WEB APPLICATIONS.
1 Functions 1 Parameter, 1 Return-Value 1. The problem 2. Recall the layout 3. Create the definition 4. "Flow" of data 5. Testing 6. Projects 1 and 2.
Arrays 1 Multiple values per variable. Why arrays? Can you collect one value from the user? How about two? Twenty? Two hundred? How about… I need to collect.
MEGN 536 – Computational Biomechanics MATLAB: Getting Started Prof. Anthony J. Petrella Computational Biomechanics Group.
1. Reminder of Symbols 2. Dialog Boxes 3. listdlg() 4. msgbox() 5. questdlg() 6. menu() Dialog Boxes Applications of Cell-Arrays 1.
ECE 1304 Introduction to Electrical and Computer Engineering Section 1.1 Introduction to MATLAB.
Chapter 4: Decision Making with Control Structures and Statements JavaScript - Introductory.
ENGR 1320 Final Review - Programming Major Topics: – Functions and Scripts – Vector and Matrix Operations in Matlab Dot product Cross product – Plotting.
Input, Output, and Processing
MATLAB Tutorial EE 327 Signals and Systems 1. What is MATLAB? MATLAB – Matrix Laboratory The premier number-crunching software Extremely useful for signal.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. A Concise Introduction to MATLAB ® William J. Palm III.
Using Client-Side Scripts to Enhance Web Applications 1.
Linux Operations and Administration
Object-Oriented Program Development Using Java: A Class-Centered Approach, Enhanced Edition.
Arrays 1 Multiple values per variable. Why arrays? Can you collect one value from the user? How about two? Twenty? Two hundred? How about… I need to collect.
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.
Getting Started with MATLAB 1. Fundamentals of MATLAB 2. Different Windows of MATLAB 1.
1. Exam Topics Difference between computers and calculators John creates a new device. It will compute the orbit of all the planets in the solar system.
Review for Exam2 Key Ideas 1. Key Ideas: Boolean Operators (2 > 3) || (3 < 29.3) A.True B.False C.Impossible to determine (22 > 3) && (3 > 29.3) A.True.
What does C store? >>A = [1 2 3] >>B = [1 1] >>[C,D]=meshgrid(A,B) c) a) d) b)
Introduction to MATLAB. CSPP58001 MATLAB MATLAB is is a matrix-based language well suited for carrying out numerical analysis. It has many, many high-
CS161 Topic #16 1 Today in CS161 Lecture #16 Prepare for the Final Reviewing all Topics this term Variables If Statements Loops (do while, while, for)
Introduction to Matlab Module #4 Page 1 Introduction to Matlab Module #4 – Programming Topics 1.Programming Basics (fprintf, standard input) 2.Relational.
A string is an array of characters Strings have many uses in MATLAB Display text output Specify formatting for plots Input arguments for some functions.
Programming Logic and Design Fourth Edition, Comprehensive Chapter 8 Arrays.
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.
Topic Review for Exam 1 0.Infrastructure: You must be able to use MATLAB, Blackboard Exams, and Blackboard submissions 1. Computer Developing algorithms.
INTRODUCTION TO MATLAB DAVID COOPER SUMMER Course Layout SundayMondayTuesdayWednesdayThursdayFridaySaturday 67 Intro 89 Scripts 1011 Work
INTRODUCTION TO MATLAB Dr. Hugh Blanton ENTC 4347.
CHAPTER 2 PROBLEM SOLVING USING C++ 1 C++ Programming PEG200/Saidatul Rahah.
Midterm Exam Topics (Prof. Chang's section) CMSC 201.
MATLAB Lecture 1 염익준. Introduction MATLAB (MATrix LABoratory) a special purpose computer program optimized to perform engineering and scientific calculations.
Higher Computing Science 2016 Prelim Revision. Topics to revise Computational Constructs parameter passing (value and reference, formal and actual) sub-programs/routines,
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
Strings Characters and Sentences 1.Overview 2.Creating Strings 3.Slicing Strings 4.Searching for substrings 1.
Programming Logic and Design Fifth Edition, Comprehensive Chapter 6 Arrays.
Introduction to R Chris Free. Introduction to R Free! Superior (if not comparable) to commercial alternatives Available on all platforms Not just for.
ECE 1304 Introduction to Electrical and Computer Engineering
Scripts & Functions Scripts and functions are contained in .m-files
MATLAB DENC 2533 ECADD LAB 9.
MATLAB: Structures and File I/O
Use of Mathematics using Technology (Maltlab)
Simulation And Modelling
Loop Statements & Vectorizing Code
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.
Matlab Basics.
Loop Statements & Vectorizing Code
Presentation transcript:

REVIEW 2 Exam 3 1

1.History of Computers 1. CPU stands for _______________________. a. Counter productive units b. Central processing unit c. Copper Part Unit d. None of the answers are valid 2. (True or False) MATLAB is a compiled language. 2

2.Getting Started with Matlab Before coding anything, what are the 5 steps to follow? S________________________________ I________________________________ M________________________________ C________________________________ T________________________________ 3

2.Getting started with Matlab In 5 steps, how many parts are included in step C of SIMCT? What are they? The command clear is a : a) built-in function b) User-defined function c) Language construct d) None of the above. 4

3.Variables, Data Types Which command creates a variable named age, assigns the value 29, and suppresses the output? a. Age = 29 b. age =29 c. 29 = age; d. None of the options is valid 5

4.Operators and Operands Which of the following are Boolean Operators? How about relational operators? a. +-*/ b. = == ~= c. || && ~ d. None of the above are valid 6

4.Operators and Operands Consider the following MATLAB code: num=10 num_condition= (num > 0) && (mod(num,4)~=0) then num_condition will evaluate to: a. 0 b. 1 c. 2 d. 3 7

5.Inputs Will the following script file allow the user to enter her/his name properly? clc clear name = input(‘Enter your name’); fprintf(‘Welcome %s!\n’, name); a. Yes b. No 8

6. Outputs What are the three methods to display results? Which method allows to print results with a specific format? What are the 4 placeholders? What is the purpose of placeholders? Which function actually uses placeholders? What are format modifiers? Which placeholder can have a format modifier that controls the number of decimal places? If there are 3 placeholders in the format string, how many variables are likely printed to the screen? 9

7. Conditionals What are the two conditionals shown that allow to skip code? Regardless whether it is if or switch, which keyword is always associated with both? What other keywords are associated with if ? What other keywords are associated with switch ? 10

8.Library Functions What are library functions? What are arguments? What are return-values? Is there a limit to the number of arguments a function can receive? Is there a limit to the number of return-values a function can have? Name 3 rounding functions? Which rounding function rounds towards +infinity? Which rounding function rounds towards -infinity? Which rounding function rounds towards the nearest integer? 11

9. Loops 12 Loops WHILE FOR choosing a loop infinite loops Changing control-loop variable in body Range operator Running Totals Running Products Using While loops to: validate input repeat the program – based on user’s selection Nesting Loops Numerical Methods Iterative solutions – “close enough” to a solution. Remember to use abs()

10. Array 13 Array Terminology Types of arrays "row", "column" empty vector [ ] Matrix Math Differences for: addition subtraction multiplication division exponentiation Defining arrays Hard-coded Range operator linspace() Re-defining array elements Eliminating array elements Augmenting arrays Array building Diminishing arrays Referencing arrays Slices

10. Array 14 Searching Linear search – “one by one” Binary search – “sorted search” Matrix Math Using scalars Using vectors & matrices vs. element-per-element Logical operations Logical vectors Find the values - Logical indexing Find the indices - find() Applying &, | to logical operations on arrays

Question How many different ways to create the following vector a? what is the length of vector a? which function can be used to determine it? How to determine minimum or maximum value in vector a? and the location? How to extract a new vector as 5 9? 15

Question How to access the number 0? How to extract vector 4 3 2? How to extract vector How to extract matrix

Question Consider the following MATLAB code: V=[ ] W=[4 6 -7] X= V(2)+W(3) Then X will be equal to: a. Error b. 2.5 c. 6.5 d

Question Consider the following MATLAB code: A= [ ] B= [ ] C= A || B Then C will return: a. Error b. [ ] c. [ ] d. [ ] 18

Question Consider the following MATLAB code: D= [ 5 9 7] F=find(D>5) then F will be equal to: a. [ 1 2 3] b. [ 2 3 ] c. [ 9 7 ] d. [ 5 9 7] 19

Question Consider the following MATLAB code: G= [ 2, 8, 9, 6; 8, 6, 9, 3; 9, 5, 7, 3] H=G(1, [2, 3]) Then H will evaluate to: a. [ 9 8] b. [ 9; 8 ] c. [ 8 9 ] d. [ 8; 9] 20

Question Consider the following MATLAB code: for k=1:3 L(k+1)=k+10; end disp(L) what is the value of L : 21

11. Cell array Mixed data type To grab the content, you need {} inputdlg() accepts its input arguments as cell array and return a cell array of strings. msgbox() accepts string as its input arguments 22

12. Programmer defined function Overall Idea? Lots of advantages? Vocabulary Function-header Function-definition Syntax? Filename? Directory? Keyword? Position of return-values and parameter list Using all the parameters Assigning all the return-Function-call Arguments vs. parameters Return-values 23

(string must be included in single quote marks) 24

Question Consider the following MATLAB code: str='7-Eleven' letterE= strfind(str,'e') then the variable letterE will evaluate to: 25

plotting plot(), plot3(), hold on, figure(), title(), xlabel(), ylabel() pie(), pie3(), bar() Polyfit(), polyval() 26 Files Why stores the data to file? When we should use high level functions, when to use low level functions?

27

28