Introduction to Matlab Programming with Applications

Size: px
Start display at page:

Download "Introduction to Matlab Programming with Applications"

Transcription

1 Introduction to Matlab Programming with Applications Zheng-Liang Lu Department of Computer Science and Information Engineering National Taiwan University Matlab 256 Summer 2015

2 Class Information Official Web page d /matlab 256.html Lecture notes will be uploaded right before class. Note that the lecture notes are organized in English. Contact information If you have any question, please contact me via . facebook Zheng-Liang Lu 1 / 70

3 Prerequisites No programming experience required. It would be helpful if you have some programming experiences. Linear Algebra is strongly recommended. Matlab refers to Matrix laboratory. Linear Algebra is widely used in numerical analysis and quantitative methods. Please be informed that you should consider other classes if you want to learn any advanced computer science courses. 1 I promise to keep everything simple in this class. 2 1 After you get familiar with one of programming languages, you may consider some advanced courses such as algorithms, computational statistics, digital image processing, and even financial engineering. 2 Simple is not easy.... Easy is a minimum amount of effort to produce a result.... Simple is very hard. Simple is the removal of everything except what matters.... See here. Zheng-Liang Lu 2 / 70

4 Grading To pass the class, you need at least 70 pts in the end of class. Programming assignment (50 pts) Final project/exam (50 pts) Please be noted that you preserve the right 3 to refund before the 5th lecture. 3 Zheng-Liang Lu 3 / 70

5 Final Project Topic: anything if you are interested in or working on. Requirement: you should use Matlab as the main programming language. Your grade depends on the following aspects: Problem definition Innovation 4 Completion Goal: To solve a problem by formulating the problem, organizing into an algorithm, writing the codes To get familiar with programming concepts To gain the experiences in order to learn more programming languages on your own 4 No copy-and-paste. You should understand the program thoroughly. Zheng-Liang Lu 4 / 70

6 Final Exam On-site programming 8 to 10 questions Open everything No communication with classmates and your friends Zheng-Liang Lu 5 / 70

7 Zheng-Liang Lu 6 / 70

8 What Is Programming? Programming is the way of writing a sequence of instructions to tell a computer to perform a specific task. A sequence of instructions program A set of well-defined notations is used to write a program programming language The person who writes a program a programmer Zheng-Liang Lu 7 / 70

9 In Practice Programming is about providing a solution to a real-world problem using computational models supported by the programming language. The solution is a program. The program must be practical and effective. Zheng-Liang Lu 8 / 70

10 Programs A (computer) program is a sequence of instructions, written in an artificial language, to perform a specified task with a computer. They are almost everywhere such that you can name it. For example, Computer virus Games 5 Operating systems 6 Social networking 7 Differences: goal, functionality, algorithms, complexity Try Pong. 6 Such as Windows 8.1, UNIX, Linux, Mac OS X, Android, and ios. 7 Such as Facebook, twitter, and so on. 8 A measure of difficulty for a specific algorithm. Zheng-Liang Lu 9 / 70

11 How and Where The Programs Run The programs are activated from the disk into the main memory. Now we call them the processes. 9 All the instructions are executed in CPU, while the data is stored in the registers. The results are written back to the main memory and further stored into the disk after the processes are terminated. 9 A formal terminology used in Operating System. Zheng-Liang Lu 10 / 70

12 Memory Hierarchy See Figure 1-9 in Bryant, p. 14. Zheng-Liang Lu 11 / 70

13 Process Virtual Address Space See Figure 1-13 in Bryant, p. 18. Zheng-Liang Lu 12 / 70

14 Programming Languages A programming language is an artificial language designed to communicate with a machine by instructions. Programming languages syntax Express algorithms Control the behavior of a machine Matlab belongs to the post 3rd-generation programming languages. 1st generation: machine code 2nd generation: assembly code 3rd generation: high-level programming languages Beyond 3rd generation Zheng-Liang Lu 13 / 70

15 Zheng-Liang Lu 14 / 70

16 1st-Generation Programming Languages The fact is, Computers understand instructions only in binary format, which is a sequence of 0s and 1s. A computer has a fixed set of basic instructions that it understands. Each computer has its own set of instructions. So, the earliest programming language is machine-dependent, so called machine code. Zheng-Liang Lu 15 / 70

17 Pros: Most efficient for machines Cons: Hard to program for human Not portable Still widely (and occasionally) used in programming lower level functions of the system, such as drivers, interfaces with firmware and hardware devices. Zheng-Liang Lu 16 / 70

18 2nd-Generation Programming Languages An assembly language uses mnemonics 12 to represent instructions as opposed to the binary (0s and 1s) used in machine language. The code can be read and written by a programmer. Yet, it is still machine-dependent. For each machine, there is one-to-one correspondence between an instruction in machine language and assembly language for a given computer architecture. 13 To run on a computer, it must be converted into a machine readable form, a process called assembly. Zheng-Liang Lu 17 / 70

19 More often find use in extremely intensive processing such as games, video editing, graphic manipulation/rendering. Note that machine language and assembly language are also known as low-level languages. 12 Easy to recognize and memorize. 13 For example, x86. See any textbook for computer organization or architecture. Zheng-Liang Lu 18 / 70

20 3rd-Generation Programming Languages The high-level programming languages use English-like words, mathematical notation, and punctuation to write programs. They are closer to the written languages that humans are familiar with. The translation is accomplished by a compiler, an interpreter, or a combination of both. Pros: Portable, machine-independent Support structured programming Human-friendly Such as C 14, C++ 15, and Java Zheng-Liang Lu 19 / 70

21 Zheng-Liang Lu 20 / 70

22 What Can A Program Do? A program is an implementation of an algorithm expressed in a specific programming language. The more important question is, do what? Zheng-Liang Lu 21 / 70

23 Algorithm In A Nutshell An algorithm is any well-defined computational procedure that takes some value, or set of values, as input and produces some value or set of values, as output. Simply put, an algorithm is a procedure that solves a particular type of problems, such as a cookbook. Zheng-Liang Lu 22 / 70

24 Properties of Algorithms Typical properties of any algorithm are summarized as follows: Input Statements: definiteness Instructions: effectiveness Number of steps: finiteness 17 Output: correctness Note that an algorithm is not necessarily expressed in a specific programming language. Instead, one can express an algorithm in some human language using a programming language format. 17 Alan Turing ( ) Zheng-Liang Lu 23 / 70

25 Example Organize an algorithm that finds the greatest element in the input list. Input: A (a list of n integers) Output: x (the greatest element in A) 1 x <-- A(1) 2 for i <-- 1 ~ n 3 if A(i) > x 4 x <-- A(i) 5 end 6 end 7 return x Zheng-Liang Lu 24 / 70

26 Computers are good at following instructions, but not at reading your mind. Donald Knuth (1938-) Zheng-Liang Lu 25 / 70

27 What is Matlab? In my view, Matlab is a powerful and simple math software: Powerful: programmable, fruitful toolboxes 18 available Simple: don t need to worry about the machine, easy to draw a graph The only thing you need to provide is Zheng-Liang Lu 26 / 70

28 Algorithms! This is a screenshot of The Social Network (2010). Zheng-Liang Lu 27 / 70

29 Conclusions Program design algorithm + programming language Algorithm idea, steps Programming language Chinese, English In this class, we will learn Matlab and some algorithms which are the core of programming world. Zheng-Liang Lu 28 / 70

30 Father of Matlab Cleve Moler Zheng-Liang Lu 29 / 70

31 Get started to implement your idea with Matlab. Zheng-Liang Lu 30 / 70

32 1 >> Lecture 1 2 >> 3 >> -- Overview of Matlab 4 >> Zheng-Liang Lu 31 / 70

33 Learning a new language is harmless. It gives you new ideas and insights. Yukihiro Matsumoto ( 松本行弘 ) (1965 ) Zheng-Liang Lu 32 / 70

34 Contents Environment Script editor Variable types Scalar variable Numeric arrays Character arrays (String) Cell arrays Structure arrays Built-in arithmetic functions Zheng-Liang Lu 33 / 70

35 Working Environment Zheng-Liang Lu 34 / 70

36 Command Window You can give a command in the Command Window. Let s try a greeting, Hello, Matlab. 1 >> disp('hello, Matlab.'); disp prints the string as input in the parenthesis. A string is single-quoted in Matlab. Convention in the slides: Boxes are the listings for programs. Words and sentences highlighted in red are important. Words in blue are reserved words. Bold words in black are functions. Zheng-Liang Lu 35 / 70

37 Tips for Learning Matlab Don t be frustrated: 紅字是必經之路 犯錯是為了下一次的成功作預演 Matlab interrupts your program when a syntax error occurs. lookfor is used to look for the commands related to the key word you give. 1 >> lookfor display disp - Display array. 4 display - Display array. 5 error - Display message and abort function. 6 warning - Display warning message; disable or enable... warning messages Zheng-Liang Lu 36 / 70

38 help returns the usage of a command 1 >> help disp 2... Help browser provides detail of commands with examples. Google is your friend. Zheng-Liang Lu 37 / 70

39 Script Editor We often write a program in the script editor. Save the program in.m file..m files are used as scripts and functions. A script is a complete program which contains the input data and can be executed directly. A function is a program which may need input data when being called in other programs. (why?) Zheng-Liang Lu 38 / 70

40 Zheng-Liang Lu 39 / 70

41 helloworld.m Let s create a.m file with the following code lines: 1 % This is the comment section. 2 clear; % Clear all variables stored in Workspace. 3 clc; % Clear the screen. 4 % main program 5 disp('hello, world.'); Note that The lines which begins with % are regarded as the comments. Comments are not executed. clear is used to release the variables. clc cleans the command window. Zheng-Liang Lu 40 / 70

42 Save 20 and press F5 21 to run the script. Do not give a script file the same name as a variable. (Why?) Do not give a filename with blanks in the middle. If the.m file is not at the current folder when you execute it, Matlab will ask: 1 Change folder 2 Add to Path Pool You can run helloworld.m later just by calling helloworld in the command window. 1 >> helloworld 2 3 Hello, world. 20 ctrl + s 21 Autosave before execution. Zheng-Liang Lu 41 / 70

43 Comments In Scripts Anything following a % is seen as a comment. Press ctrl + r to comment. ctrl + t to de-comment. To comment a block of lines, %{ %}. The first contiguous comment becomes the script s help document. 1 >> help helloworld 2 3 This is the comment section. Why documents? Helpful for both the programmers and users. Avoid wasting time later. Zheng-Liang Lu 42 / 70

44 Variables Variable is used to store a value, assigned by variable name = expression. x = x + 1 is correct. (Why?) Actually, the assignment operator is used to put a value in the variable, from right to left. For example, let a = 10, b = 20. Then a + b = >> a = 10; 2 >> b = 20; 3 >> a + b 4 5 ans = 6 30 ans is the default variable if you don t assign one for it. Zheng-Liang Lu 43 / 70

45 If you drop the semicolon (;) in the line, then the result will appear in the command window, say, 1 >> a = a = Note that you may not drop semicolons in other programming languages. The variable name is suggested to begin with a letter of the alphabet. Cannot begin with a number, e.g. 1x is wrong. Cannot have a blank, e.g. x 1 is wrong. Cannot have +-*\%, e.g. x%1 Zheng-Liang Lu 44 / 70

46 Matlab is case-sensitive 22, e.g. A and a are different. The length of name is limited to 63 characters 23. namelengthmax returns what this maximum length is. We avoid to use names of reserved words 24 and built-in functions. The reserved words cannot be used as a variable, e.g. for, if, and end. i = 1 and j = 1 by default. If you set i = 1, then i = 1 until you clear i. Variable names should always be mnemonic In general, programming languages are case-sensitive, but some are not, e.g. Fortran. 23 Windows 7 (64-bit) in this case 24 Try iskeyword. 25 To assist your memory. Zheng-Liang Lu 45 / 70

47 Data Type and Casting Everything is encoded by binary numbers (0 and 1) in a certain size. Particularly, the integers and real numbers, actually floating points, are different data types. (Why?) Different types of variables occupy different size of memory. All numeric variables are stored as the type double 26 by default. Variables defined in type char are of size 2 bytes. Variables defined in type logical are of size 1 bytes. whos shows variables that have been defined in the command window. cast converts one variable to another type. int8, int16, int32, and int64 are the integer types bytes = 64 bits. Zheng-Liang Lu 46 / 70

48 Computational Limits In Matlab, it is a common convention to use e to identify a power of 10, e.g. 1e5 = 100, 000. Zheng-Liang Lu 47 / 70

49 Scalar Variables A scalar is a single number. A scalar variable is a variable that contains a single number. x is said to be a scalar variable if x R 1 or C 1. The complex field, denoted by C, contains all the complex numbers, in form of a + bi, where i = 1, and a, b R 1. Try x = 1 + i in the command window. In math, C 1 is equivalent to R 2. So, x is stored as the type double with 16 = 8 2 bytes. Zheng-Liang Lu 48 / 70

50 Scalar Arithmetic Operators See Table 2.1 Arithmetic Operations Between Two Scalars in Moore, p. 21. Zheng-Liang Lu 49 / 70

51 Display Format See Table Numeric display formats in Palm, p. 15. Zheng-Liang Lu 50 / 70

52 Arrays One of the strengths of Matlab is its ability to handle collections of numbers, called arrays, as if they were a single variable. An array is a systematic arrangement of objects, such as Row vectors: x R 1 n for any positive integer n. Column vectors: x R n 1 for any positive integer n. Matrices: A R n m for any positive integers n, m. Zheng-Liang Lu 51 / 70

53 The dimension of a general array is unlimited without regarding to the limit of memory space. You can create an n m k matrix for any positive integers n, m, k,.... (Try.) For example, let A be a matrix. Then it takes MB in memory space. Actually, all the arrays are stored in a continuous memory space. Zheng-Liang Lu 52 / 70

54 Example 1 >> row vector = [1 2 3] % [... ] is used in arrays. 2 3 row vector = >> column vector = [1;2;3] % semicolon is used to change... rows column vector = >> matrix=[1 2 3; 4 5 6; 7 8 9] % define a 3-by-3 matrix 16 Zheng-Liang Lu 53 / 70

55 17 matrix = Zheng-Liang Lu 54 / 70

56 Some special matrices can be initialized by the following functions: Zheng-Liang Lu 55 / 70

57 Referring to Matrix Elements Index of arrays in Matlab starts from 1 not 0. Note that it does start from 0 in C. Matrices can be indexed in two ways: Subscripted indexing Linear indexing: matrices are arrays stored in a continuous memory space in column major order. 1 >> matrix(2,3) % using subscripted indexing 2 3 ans = >> matrix(8) % using linear indexing 7 8 ans = 9 6 Zheng-Liang Lu 56 / 70

58 Example: Deleting Elements 1 >> matrix(2, [1 3]) 2 3 ans = >> matrix(:, 1) = [] % delete the first column vector matrix = Zheng-Liang Lu 57 / 70

59 Automatic Initialization of Array linspace(,, ) initializes a linear vector of values. 1 >> x = linspace(0,10,5) % start, end, points 2 3 x = You can also use colon operator (:) to create a vector. For example, 1 >> x = 0 : 2 : 10 % start : increment : end 2 3 x = logspace initializes logarithmically spaced values. (Try.) Zheng-Liang Lu 58 / 70

60 Example: Invalid Vector Creation 1 >> x = 1 : -1 : x = 4 5 Empty matrix: 1-by-0 We will use this property later. Zheng-Liang Lu 59 / 70

61 Strings Recall that a string in Matlab is single-quoted. Let x = Arthur. Then x stores a string. 1 >> x = 'Arthur' 2 3 x = 4 5 Arthur 6 7 >> Actually, x is an array whose elements store a character in order. Zheng-Liang Lu 60 / 70

62 Tricks with Arrays It is easy to manipulate the arrays, including strings. For example, 1 >> x = 'Arthur'; 2 >> x = [x ' meets Matlab.'] % string concatenation 3 4 x = 5 6 Arthur meets Matlab. 7 8 >> x=[x; 'This is Matlab252.'] % Cause an error? But it is not useful to store strings in different length. Also, an array cannot contain data of different types! Zheng-Liang Lu 61 / 70

63 Cell Array A cell array is a data type with indexed data containers called cells, where each cell can contain any type of data. Cell arrays commonly contain either lists of text strings, combinations of text and numbers, or numeric arrays of different sizes. Zheng-Liang Lu 62 / 70

64 Example 1 >> A(1,1) = {'This is the first cell.'}; 2 >> A(1,2) = {[5 + j * 6, 4 + j * 5]}; 3 >> A(2,1) = {[1 2 3; 4 5 6; 7 8 9]}; 4 >> A(2,2) = {{'Tim'; 'Chris'}} ; 5 >> A 6 7 A = 8 9 'This is the first cell.' [1x2 double] 10 [3x3 double] {2x1 cell } celldisp(c) recursively displays the contents of a cell array C. Zheng-Liang Lu 63 / 70

65 Referring to Cell Array Using curly braces, { }, for the subscripts will reference the contents of a cell; this is called context indexing. Using parentheses, ( ), for the subscripts references the cell; this is called cell indexing. 1 >> A{1} 2 ans = 3 This is the first cell. % check this type 4 >> A(1) 5 ans = 6 'This is the first cell.' % check this type More details can be found in here. Zheng-Liang Lu 64 / 70

66 Structure Array A structure array is a data type that groups related data using data containers called fields. Each field can contain any type of data. You can access data of the structure array by dot operator in the form of structname.fieldname. For example, 1 >> student.name = 'Arthur'; 2 >> student.id = 'd '; 3 >> student.scores = [80, 90, 100]; 4 >> student % show the content of student 5 >> 6 7 student = 8 Zheng-Liang Lu 65 / 70

67 9 name: 'Arthur' 10 id: 'd ' 11 scores: [ ] fieldnames returns the names of the fields contained in a structure variable. rmfield removes a field from a structure. You can pass structures to functions. More details can be found here. They are extremely useful in applications such as Matlab GUI and database management. Zheng-Liang Lu 66 / 70

68 Symbols In Workspace Zheng-Liang Lu 67 / 70

69 Basic Math Functions See Table in Palm, p Zheng-Liang Lu 68 / 70

70 Trigonometric Functions 30 Recall that 1 rad = 180 π. 30 See Table Zheng-Liang in Palm, Lu p / 70

71 Summary: 31 Parentheses ( ) Arithmetic, e.g. (x + y)/z. Input arguments of a function, e.g. sin(1), exp(1). Array addressing, e.g. A(1) refers to the first element in array A. Square brackets [ ]: only used in array operations e.g. x = [ ]. Curly brackets { }: only used to declare a cell array e.g. A = { This is Matlab class., x}. 31 Thanks to a lively class discussion (Matlab-237) on April 16, Zheng-Liang Lu 70 / 70

Introduction to Matlab Programming with Applications

Introduction to Matlab Programming with Applications Introduction to Matlab Programming with Applications Zheng-Liang Lu Department of Computer Science and Information Engineering National Taiwan University Matlab 289 Summer 2017 Class Information ˆ The

More information

AP Computer Science A: Java Programming

AP Computer Science A: Java Programming AP Computer Science A: Java Programming Zheng-Liang Lu Department of Computer Science & Information Engineering National Taiwan University APcomSci 297 Spring 2018 Class Information Instructor: Zheng-Liang

More information

AP Computer Science A

AP Computer Science A AP Computer Science A Zheng-Liang Lu Department of Computer Science and Information Engineering National Taiwan University APcomSciA 268 Summer 2016 Class Information The class website, http://www.csie.ntu.edu.tw/

More information

Java Programming. Zheng-Liang Lu. Java 308 Spring Department of Computer Science & Information Engineering National Taiwan University

Java Programming. Zheng-Liang Lu. Java 308 Spring Department of Computer Science & Information Engineering National Taiwan University Java Programming Zheng-Liang Lu Department of Computer Science & Information Engineering National Taiwan University Java 308 Spring 2019 Class Information Instructor: Zheng-Liang Lu Email: d00922011@ntu.edu.tw

More information

Java Programming. Zheng-Liang Lu. Java 301 Summer Department of Computer Science & Information Engineering National Taiwan University

Java Programming. Zheng-Liang Lu. Java 301 Summer Department of Computer Science & Information Engineering National Taiwan University Java Programming Zheng-Liang Lu Department of Computer Science & Information Engineering National Taiwan University Java 301 Summer 2018 Class Information Instructor: Zheng-Liang Lu Email: d00922011@csie.ntu.edu.tw

More information

Java Programming. Zheng-Liang Lu. Java 304 Fall Department of Computer Science & Information Engineering National Taiwan University

Java Programming. Zheng-Liang Lu. Java 304 Fall Department of Computer Science & Information Engineering National Taiwan University Java Programming Zheng-Liang Lu Department of Computer Science & Information Engineering National Taiwan University Java 304 Fall 2018 Class Information Instructor: Zheng-Liang Lu Email: d00922011@ntu.edu.tw

More information

Structure Array 1 / 50

Structure Array 1 / 50 Structure Array A structure array is a data type that groups related data using data containers called fields. Each field can contain any type of data. Access data in a structure using dot notation of

More information

CITS2401 Computer Analysis & Visualisation

CITS2401 Computer Analysis & Visualisation FACULTY OF ENGINEERING, COMPUTING AND MATHEMATICS CITS2401 Computer Analysis & Visualisation SCHOOL OF COMPUTER SCIENCE AND SOFTWARE ENGINEERING Topic 3 Introduction to Matlab Material from MATLAB for

More information

Variables and Assignments

Variables and Assignments Variables and Assignments ˆ A variable is used to keep a value or values. ˆ A box which contains something. ˆ In most languages, a statement looks like var = expression, where var is a variable and expression

More information

An Introduction to MATLAB See Chapter 1 of Gilat

An Introduction to MATLAB See Chapter 1 of Gilat 1 An Introduction to MATLAB See Chapter 1 of Gilat Kipp Martin University of Chicago Booth School of Business January 25, 2012 Outline The MATLAB IDE MATLAB is an acronym for Matrix Laboratory. It was

More information

Introduction to MATLAB

Introduction to MATLAB Chapter 1 Introduction to MATLAB 1.1 Software Philosophy Matrix-based numeric computation MATrix LABoratory built-in support for standard matrix and vector operations High-level programming language Programming

More information

MATLAB = MATrix LABoratory. Interactive system. Basic data element is an array that does not require dimensioning.

MATLAB = MATrix LABoratory. Interactive system. Basic data element is an array that does not require dimensioning. Introduction MATLAB = MATrix LABoratory Interactive system. Basic data element is an array that does not require dimensioning. Efficient computation of matrix and vector formulations (in terms of writing

More information

Java Programming. U Hou Lok. Java Aug., Department of Computer Science and Information Engineering, National Taiwan University

Java Programming. U Hou Lok. Java Aug., Department of Computer Science and Information Engineering, National Taiwan University Java Programming U Hou Lok Department of Computer Science and Information Engineering, National Taiwan University Java 272 8 19 Aug, 2016 U Hou Lok Java Programming 1 / 78 Class Information Lecturer: U

More information

Appendix A. Introduction to MATLAB. A.1 What Is MATLAB?

Appendix A. Introduction to MATLAB. A.1 What Is MATLAB? Appendix A Introduction to MATLAB A.1 What Is MATLAB? MATLAB is a technical computing environment developed by The Math- Works, Inc. for computation and data visualization. It is both an interactive system

More information

Course Layout. Go to https://www.license.boun.edu.tr, follow instr. Accessible within campus (only for the first download)

Course Layout. Go to https://www.license.boun.edu.tr, follow instr. Accessible within campus (only for the first download) Course Layout Lectures 1: Variables, Scripts and Operations 2: Visualization and Programming 3: Solving Equations, Fitting 4: Images, Animations, Advanced Methods 5: Optional: Symbolic Math, Simulink Course

More information

MATLAB BASICS. M Files. Objectives

MATLAB BASICS. M Files. Objectives Objectives MATLAB BASICS 1. What is MATLAB and why has it been selected to be the tool of choice for DIP? 2. What programming environment does MATLAB offer? 3. What are M-files? 4. What is the difference

More information

MATLAB Basics. Configure a MATLAB Package 6/7/2017. Stanley Liang, PhD York University. Get a MATLAB Student License on Matworks

MATLAB Basics. Configure a MATLAB Package 6/7/2017. Stanley Liang, PhD York University. Get a MATLAB Student License on Matworks MATLAB Basics Stanley Liang, PhD York University Configure a MATLAB Package Get a MATLAB Student License on Matworks Visit MathWorks at https://www.mathworks.com/ It is recommended signing up with a student

More information

Introduction to MATLAB

Introduction to MATLAB Introduction to MATLAB 1 Introduction to MATLAB A Tutorial for the Course Computational Intelligence http://www.igi.tugraz.at/lehre/ci Stefan Häusler Institute for Theoretical Computer Science Inffeldgasse

More information

Introduction to MATLAB Programming

Introduction to MATLAB Programming Introduction to MATLAB Programming Arun A. Balakrishnan Asst. Professor Dept. of AE&I, RSET Overview 1 Overview 2 Introduction 3 Getting Started 4 Basics of Programming Overview 1 Overview 2 Introduction

More information

Introduction to MATLAB for Engineers, Third Edition

Introduction to MATLAB for Engineers, Third Edition PowerPoint to accompany Introduction to MATLAB for Engineers, Third Edition William J. Palm III Chapter 2 Numeric, Cell, and Structure Arrays Copyright 2010. The McGraw-Hill Companies, Inc. This work is

More information

Introduction to MATLAB

Introduction to MATLAB to MATLAB Spring 2019 to MATLAB Spring 2019 1 / 39 The Basics What is MATLAB? MATLAB Short for Matrix Laboratory matrix data structures are at the heart of programming in MATLAB We will consider arrays

More information

ECON 502 INTRODUCTION TO MATLAB Nov 9, 2007 TA: Murat Koyuncu

ECON 502 INTRODUCTION TO MATLAB Nov 9, 2007 TA: Murat Koyuncu ECON 502 INTRODUCTION TO MATLAB Nov 9, 2007 TA: Murat Koyuncu 0. What is MATLAB? 1 MATLAB stands for matrix laboratory and is one of the most popular software for numerical computation. MATLAB s basic

More information

OUTLINES. Variable names in MATLAB. Matrices, Vectors and Scalar. Entering a vector Colon operator ( : ) Mathematical operations on vectors.

OUTLINES. Variable names in MATLAB. Matrices, Vectors and Scalar. Entering a vector Colon operator ( : ) Mathematical operations on vectors. 1 LECTURE 3 OUTLINES Variable names in MATLAB Examples Matrices, Vectors and Scalar Scalar Vectors Entering a vector Colon operator ( : ) Mathematical operations on vectors examples 2 VARIABLE NAMES IN

More information

EGR 111 Introduction to MATLAB

EGR 111 Introduction to MATLAB EGR 111 Introduction to MATLAB This lab introduces the MATLAB help facility, shows how MATLAB TM, which stands for MATrix LABoratory, can be used as an advanced calculator. This lab also introduces assignment

More information

Introduction to Matlab. By: Dr. Maher O. EL-Ghossain

Introduction to Matlab. By: Dr. Maher O. EL-Ghossain Introduction to Matlab By: Dr. Maher O. EL-Ghossain Outline: q What is Matlab? Matlab Screen Variables, array, matrix, indexing Operators (Arithmetic, relational, logical ) Display Facilities Flow Control

More information

Full file at

Full file at Java Programming: From Problem Analysis to Program Design, 3 rd Edition 2-1 Chapter 2 Basic Elements of Java At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class

More information

Variables are used to store data (numbers, letters, etc) in MATLAB. There are a few rules that must be followed when creating variables in MATLAB:

Variables are used to store data (numbers, letters, etc) in MATLAB. There are a few rules that must be followed when creating variables in MATLAB: Contents VARIABLES... 1 Storing Numerical Data... 2 Limits on Numerical Data... 6 Storing Character Strings... 8 Logical Variables... 9 MATLAB S BUILT-IN VARIABLES AND FUNCTIONS... 9 GETTING HELP IN MATLAB...

More information

How to program with Matlab (PART 1/3)

How to program with Matlab (PART 1/3) Programming course 1 09/12/2013 Martin SZINTE How to program with Matlab (PART 1/3) Plan 0. Setup of Matlab. 1. Matlab: the software interface. - Command window - Command history - Section help - Current

More information

Starting with a great calculator... Variables. Comments. Topic 5: Introduction to Programming in Matlab CSSE, UWA

Starting with a great calculator... Variables. Comments. Topic 5: Introduction to Programming in Matlab CSSE, UWA Starting with a great calculator... Topic 5: Introduction to Programming in Matlab CSSE, UWA! MATLAB is a high level language that allows you to perform calculations on numbers, or arrays of numbers, in

More information

Constraint-based Metabolic Reconstructions & Analysis H. Scott Hinton. Matlab Tutorial. Lesson: Matlab Tutorial

Constraint-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 information

C H A P T E R 1. Introduction to Computers and Programming

C H A P T E R 1. Introduction to Computers and Programming C H A P T E R 1 Introduction to Computers and Programming Topics Introduction Hardware and Software How Computers Store Data How a Program Works Using Python Computer Uses What do students use computers

More information

7/8/10 KEY CONCEPTS. Problem COMP 10 EXPLORING COMPUTER SCIENCE. Algorithm. Lecture 2 Variables, Types, and Programs. Program PROBLEM SOLVING

7/8/10 KEY CONCEPTS. Problem COMP 10 EXPLORING COMPUTER SCIENCE. Algorithm. Lecture 2 Variables, Types, and Programs. Program PROBLEM SOLVING KEY CONCEPTS COMP 10 EXPLORING COMPUTER SCIENCE Lecture 2 Variables, Types, and Programs Problem Definition of task to be performed (by a computer) Algorithm A particular sequence of steps that will solve

More information

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #29 Arrays in C

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #29 Arrays in C Introduction to Programming in C Department of Computer Science and Engineering Lecture No. #29 Arrays in C (Refer Slide Time: 00:08) This session will learn about arrays in C. Now, what is the word array

More information

An Introduction to MATLAB

An 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 information

1 Introduction to MATLAB

1 Introduction to MATLAB 1 Introduction to MATLAB 1.1 Quick Overview This chapter is not intended to be a comprehensive manual of MATLAB R. Our sole aim is to provide sufficient information to give you a good start. If you are

More information

Pace University. Fundamental Concepts of CS121 1

Pace University. Fundamental Concepts of CS121 1 Pace University Fundamental Concepts of CS121 1 Dr. Lixin Tao http://csis.pace.edu/~lixin Computer Science Department Pace University October 12, 2005 This document complements my tutorial Introduction

More information

ECE Lesson Plan - Class 1 Fall, 2001

ECE Lesson Plan - Class 1 Fall, 2001 ECE 201 - Lesson Plan - Class 1 Fall, 2001 Software Development Philosophy Matrix-based numeric computation - MATrix LABoratory High-level programming language - Programming data type specification not

More information

SECTION 1: INTRODUCTION. ENGR 112 Introduction to Engineering Computing

SECTION 1: INTRODUCTION. ENGR 112 Introduction to Engineering Computing SECTION 1: INTRODUCTION ENGR 112 Introduction to Engineering Computing 2 Course Overview What is Programming? 3 Programming The implementation of algorithms in a particular computer programming language

More information

CSCE 120: Learning To Code

CSCE 120: Learning To Code CSCE 120: Learning To Code Manipulating Data I Introduction This module is designed to get you started working with data by understanding and using variables and data types in JavaScript. It will also

More information

McTutorial: A MATLAB Tutorial

McTutorial: A MATLAB Tutorial McGill University School of Computer Science Sable Research Group McTutorial: A MATLAB Tutorial Lei Lopez Last updated: August 2014 w w w. s a b l e. m c g i l l. c a Contents 1 MATLAB BASICS 3 1.1 MATLAB

More information

VARIABLES Storing numbers:

VARIABLES Storing numbers: VARIABLES Storing numbers: You may create and use variables in Matlab to store data. There are a few rules on naming variables though: (1) Variables must begin with a letter and can be followed with any

More information

Computer Programming in MATLAB

Computer Programming in MATLAB Computer Programming in MATLAB Prof. Dr. İrfan KAYMAZ Atatürk University Engineering Faculty Department of Mechanical Engineering What is a computer??? Computer is a device that computes, especially a

More information

Introduction to Matlab. Summer School CEA-EDF-INRIA 2011 of Numerical Analysis

Introduction to Matlab. Summer School CEA-EDF-INRIA 2011 of Numerical Analysis Introduction to Matlab 1 Outline What is Matlab? Matlab desktop & interface Scalar variables Vectors and matrices Exercise 1 Booleans Control structures File organization User defined functions Exercise

More information

Lab of COMP 406. MATLAB: Quick Start. Lab tutor : Gene Yu Zhao Mailbox: or Lab 1: 11th Sep, 2013

Lab of COMP 406. MATLAB: Quick Start. Lab tutor : Gene Yu Zhao Mailbox: or Lab 1: 11th Sep, 2013 Lab of COMP 406 MATLAB: Quick Start Lab tutor : Gene Yu Zhao Mailbox: csyuzhao@comp.polyu.edu.hk or genexinvivian@gmail.com Lab 1: 11th Sep, 2013 1 Where is Matlab? Find the Matlab under the folder 1.

More information

Introduction to MATLAB 7 for Engineers

Introduction to MATLAB 7 for Engineers PowerPoint to accompany Introduction to MATLAB 7 for Engineers William J. Palm III Chapter 2 Numeric, Cell, and Structure Arrays Copyright 2005. The McGraw-Hill Companies, Inc. Permission required for

More information

SMS 3515: Scientific Computing Lecture 1: Introduction to Matlab 2014

SMS 3515: Scientific Computing Lecture 1: Introduction to Matlab 2014 SMS 3515: Scientific Computing Lecture 1: Introduction to Matlab 2014 Instructor: Nurul Farahain Mohammad 1 It s all about MATLAB What is MATLAB? MATLAB is a mathematical and graphical software package

More information

2.0 MATLAB Fundamentals

2.0 MATLAB Fundamentals 2.0 MATLAB Fundamentals 2.1 INTRODUCTION MATLAB is a computer program for computing scientific and engineering problems that can be expressed in mathematical form. The name MATLAB stands for MATrix LABoratory,

More information

1 Introduction to MATLAB

1 Introduction to MATLAB 1 Introduction to MATLAB 1.1 General Information Quick Overview This chapter is not intended to be a comprehensive manual of MATLAB R. Our sole aim is to provide sufficient information to give you a good

More information

AN INTRODUCTION TO MATLAB

AN INTRODUCTION TO MATLAB AN INTRODUCTION TO MATLAB 1 Introduction MATLAB is a powerful mathematical tool used for a number of engineering applications such as communication engineering, digital signal processing, control engineering,

More information

Visual C# Instructor s Manual Table of Contents

Visual C# Instructor s Manual Table of Contents Visual C# 2005 2-1 Chapter 2 Using Data At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class Discussion Topics Additional Projects Additional Resources Key Terms

More information

MBI REU Matlab Tutorial

MBI REU Matlab Tutorial MBI REU Matlab Tutorial Lecturer: Reginald L. McGee II, Ph.D. June 8, 2017 MATLAB MATrix LABoratory MATLAB is a tool for numerical computation and visualization which allows Real & Complex Arithmetics

More information

Introduction to MATLAB

Introduction to MATLAB Introduction to MATLAB The Desktop When you start MATLAB, the desktop appears, containing tools (graphical user interfaces) for managing files, variables, and applications associated with MATLAB. The following

More information

Starting Matlab. MATLAB Laboratory 09/09/10 Lecture. Command Window. Drives/Directories. Go to.

Starting Matlab. MATLAB Laboratory 09/09/10 Lecture. Command Window. Drives/Directories. Go to. Starting Matlab Go to MATLAB Laboratory 09/09/10 Lecture Lisa A. Oberbroeckling Loyola University Maryland loberbroeckling@loyola.edu http://ctx.loyola.edu and login with your Loyola name and password...

More information

CHAPTER 1 Introduction to Computers and Java

CHAPTER 1 Introduction to Computers and Java CHAPTER 1 Introduction to Computers and Java Copyright 2016 Pearson Education, Inc., Hoboken NJ Chapter Topics Chapter 1 discusses the following main topics: Why Program? Computer Systems: Hardware and

More information

Lecture 05 I/O statements Printf, Scanf Simple statements, Compound statements

Lecture 05 I/O statements Printf, Scanf Simple statements, Compound statements Programming, Data Structures and Algorithms Prof. Shankar Balachandran Department of Computer Science and Engineering Indian Institute of Technology, Madras Lecture 05 I/O statements Printf, Scanf Simple

More information

Topics. Hardware and Software. Introduction. Main Memory. The CPU 9/21/2014. Introduction to Computers and Programming

Topics. Hardware and Software. Introduction. Main Memory. The CPU 9/21/2014. Introduction to Computers and Programming Topics C H A P T E R 1 Introduction to Computers and Programming Introduction Hardware and Software How Computers Store Data Using Python Introduction Computers can be programmed Designed to do any job

More information

SIMPLE INPUT and OUTPUT:

SIMPLE INPUT and OUTPUT: SIMPLE INPUT and OUTPUT: (A) Printing to the screen. The disp( ) command. If you want to print out the values of a variable to the screen, you simply can type the variable at the command line. > x = 5

More information

Interactive MATLAB use. Often, many steps are needed. Automated data processing is common in Earth science! only good if problem is simple

Interactive MATLAB use. Often, many steps are needed. Automated data processing is common in Earth science! only good if problem is simple Chapter 2 Interactive MATLAB use only good if problem is simple Often, many steps are needed We also want to be able to automate repeated tasks Automated data processing is common in Earth science! Automated

More information

Arrays. ˆ An array, is a linear data structure consisting of a collection of elements, each identified by one array index. ˆ For math, arrays could be

Arrays. ˆ An array, is a linear data structure consisting of a collection of elements, each identified by one array index. ˆ For math, arrays could be Arrays ˆ An array, is a linear data structure consisting of a collection of elements, each identified by one array index. ˆ For math, arrays could be ˆ row vectors: u R 1 n for any positive integer n ˆ

More information

PART 1 PROGRAMMING WITH MATHLAB

PART 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 information

TOPIC 2 INTRODUCTION TO JAVA AND DR JAVA

TOPIC 2 INTRODUCTION TO JAVA AND DR JAVA 1 TOPIC 2 INTRODUCTION TO JAVA AND DR JAVA Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach by M. Guzdial and B. Ericson, and instructor materials prepared

More information

Zheng-Liang Lu Java Programming 45 / 79

Zheng-Liang Lu Java Programming 45 / 79 1 class Lecture2 { 2 3 "Elementray Programming" 4 5 } 6 7 / References 8 [1] Ch. 2 in YDL 9 [2] Ch. 2 and 3 in Sharan 10 [3] Ch. 2 in HS 11 / Zheng-Liang Lu Java Programming 45 / 79 Example Given a radius

More information

EE3TP4: Signals and Systems Lab 1: Introduction to Matlab Tim Davidson Ext Objective. Report. Introduction to Matlab

EE3TP4: Signals and Systems Lab 1: Introduction to Matlab Tim Davidson Ext Objective. Report. Introduction to Matlab EE3TP4: Signals and Systems Lab 1: Introduction to Matlab Tim Davidson Ext. 27352 davidson@mcmaster.ca Objective To help you familiarize yourselves with Matlab as a computation and visualization tool in

More information

Matlab- Command Window Operations, Scalars and Arrays

Matlab- Command Window Operations, Scalars and Arrays 1 ME313 Homework #1 Matlab- Command Window Operations, Scalars and Arrays Last Updated August 17 2012. Assignment: Read and complete the suggested commands. After completing the exercise, copy the contents

More information

Matrix Manipula;on with MatLab

Matrix Manipula;on with MatLab Laboratory of Image Processing Matrix Manipula;on with MatLab Pier Luigi Mazzeo pierluigi.mazzeo@cnr.it Goals Introduce the Notion of Variables & Data Types. Master Arrays manipulation Learn Arrays Mathematical

More information

Alternate Appendix A: Using the TI-92 Calculator

Alternate Appendix A: Using the TI-92 Calculator Alternate Appendix A: Using the TI-92 Calculator This document summarizes TI-92 calculation and programming operations as they relate to the text, Inside Your Calculator. Even those who do not read the

More information

MATLAB Programming for Numerical Computation Dr. Niket Kaisare Department Of Chemical Engineering Indian Institute of Technology, Madras

MATLAB Programming for Numerical Computation Dr. Niket Kaisare Department Of Chemical Engineering Indian Institute of Technology, Madras MATLAB Programming for Numerical Computation Dr. Niket Kaisare Department Of Chemical Engineering Indian Institute of Technology, Madras Module No. #01 Lecture No. #1.1 Introduction to MATLAB programming

More information

CMSC 150 LECTURE 1 INTRODUCTION TO COURSE COMPUTER SCIENCE HELLO WORLD

CMSC 150 LECTURE 1 INTRODUCTION TO COURSE COMPUTER SCIENCE HELLO WORLD CMSC 150 INTRODUCTION TO COMPUTING ACKNOWLEDGEMENT: THESE SLIDES ARE ADAPTED FROM SLIDES PROVIDED WITH INTRODUCTION TO JAVA PROGRAMMING, LIANG (PEARSON 2014) LECTURE 1 INTRODUCTION TO COURSE COMPUTER SCIENCE

More information

MATLAB The first steps. Edited by Péter Vass

MATLAB The first steps. Edited by Péter Vass MATLAB The first steps Edited by Péter Vass MATLAB The name MATLAB is derived from the expression MATrix LABoratory. It is used for the identification of a software and a programming language. As a software,

More information

S206E Lecture 19, 5/24/2016, Python an overview

S206E Lecture 19, 5/24/2016, Python an overview S206E057 Spring 2016 Copyright 2016, Chiu-Shui Chan. All Rights Reserved. Global and local variables: differences between the two Global variable is usually declared at the start of the program, their

More information

Why use MATLAB? Mathematcal computations. Used a lot for problem solving. Statistical Analysis (e.g., mean, min) Visualisation (1D-3D)

Why use MATLAB? Mathematcal computations. Used a lot for problem solving. Statistical Analysis (e.g., mean, min) Visualisation (1D-3D) MATLAB(motivation) Why use MATLAB? Mathematcal computations Used a lot for problem solving Statistical Analysis (e.g., mean, min) Visualisation (1D-3D) Signal processing (Fourier transform, etc.) Image

More information

Week - 01 Lecture - 04 Downloading and installing Python

Week - 01 Lecture - 04 Downloading and installing Python Programming, Data Structures and Algorithms in Python Prof. Madhavan Mukund Department of Computer Science and Engineering Indian Institute of Technology, Madras Week - 01 Lecture - 04 Downloading and

More information

ELEMENTARY MATLAB PROGRAMMING

ELEMENTARY MATLAB PROGRAMMING 1 ELEMENTARY MATLAB PROGRAMMING (Version R2013a used here so some differences may be encountered) COPYRIGHT Irving K. Robbins 1992, 1998, 2014, 2015 All rights reserved INTRODUCTION % It is assumed the

More information

Chapter 2: Introduction to C++

Chapter 2: Introduction to C++ Chapter 2: Introduction to C++ Copyright 2010 Pearson Education, Inc. Copyright Publishing as 2010 Pearson Pearson Addison-Wesley Education, Inc. Publishing as Pearson Addison-Wesley 2.1 Parts of a C++

More information

Chapter 2: Special Characters. Parts of a C++ Program. Introduction to C++ Displays output on the computer screen

Chapter 2: Special Characters. Parts of a C++ Program. Introduction to C++ Displays output on the computer screen Chapter 2: Introduction to C++ 2.1 Parts of a C++ Program Copyright 2009 Pearson Education, Inc. Copyright 2009 Publishing Pearson as Pearson Education, Addison-Wesley Inc. Publishing as Pearson Addison-Wesley

More information

Our Strategy for Learning Fortran 90

Our Strategy for Learning Fortran 90 Our Strategy for Learning Fortran 90 We want to consider some computational problems which build in complexity. evaluating an integral solving nonlinear equations vector/matrix operations fitting data

More information

University of Alberta

University of Alberta A Brief Introduction to MATLAB University of Alberta M.G. Lipsett 2008 MATLAB is an interactive program for numerical computation and data visualization, used extensively by engineers for analysis of systems.

More information

MATLAB Fundamentals. Berlin Chen Department of Computer Science & Information Engineering National Taiwan Normal University

MATLAB Fundamentals. Berlin Chen Department of Computer Science & Information Engineering National Taiwan Normal University MATLAB Fundamentals Berlin Chen Department of Computer Science & Information Engineering National Taiwan Normal University Reference: 1. Applied Numerical Methods with MATLAB for Engineers, Chapter 2 &

More information

Laboratory Assignment #3 Eclipse CDT

Laboratory Assignment #3 Eclipse CDT Lab 3 September 12, 2010 CS-2303, System Programming Concepts, A-term 2012 Objective Laboratory Assignment #3 Eclipse CDT Due: at 11:59 pm on the day of your lab session To learn to learn to use the Eclipse

More information

Programming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

Programming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Programming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture 04 Programs with IO and Loop We will now discuss the module 2,

More information

BASIC COMPUTATION. public static void main(string [] args) Fundamentals of Computer Science I

BASIC COMPUTATION. public static void main(string [] args) Fundamentals of Computer Science I BASIC COMPUTATION x public static void main(string [] args) Fundamentals of Computer Science I Outline Using Eclipse Data Types Variables Primitive and Class Data Types Expressions Declaration Assignment

More information

Computational Methods of Scientific Programming

Computational Methods of Scientific Programming 12.010 Computational Methods of Scientific Programming Lecturers Thomas A Herring, Jim Elliot, Chris Hill, Summary of Today s class We will look at Matlab: History Getting help Variable definitions and

More information

Course Outline. Introduction to java

Course Outline. Introduction to java Course Outline 1. Introduction to OO programming 2. Language Basics Syntax and Semantics 3. Algorithms, stepwise refinements. 4. Quiz/Assignment ( 5. Repetitions (for loops) 6. Writing simple classes 7.

More information

Last Time. University of British Columbia CPSC 111, Intro to Computation Alan J. Hu. Readings

Last Time. University of British Columbia CPSC 111, Intro to Computation Alan J. Hu. Readings University of British Columbia CPSC 111, Intro to Computation Alan J. Hu Writing a Simple Java Program Intro to Variables Readings Your textbook is Big Java (3rd Ed). This Week s Reading: Ch 2.1-2.5, Ch

More information

Module 6: Array in C

Module 6: Array in C 1 Table of Content 1. Introduction 2. Basics of array 3. Types of Array 4. Declaring Arrays 5. Initializing an array 6. Processing an array 7. Summary Learning objectives 1. To understand the concept of

More information

Computer Science 2500 Computer Organization Rensselaer Polytechnic Institute Spring Topic Notes: C and Unix Overview

Computer Science 2500 Computer Organization Rensselaer Polytechnic Institute Spring Topic Notes: C and Unix Overview Computer Science 2500 Computer Organization Rensselaer Polytechnic Institute Spring 2009 Topic Notes: C and Unix Overview This course is about computer organization, but since most of our programming is

More information

Math 395 Homework #1 Due Wednesday, April 12

Math 395 Homework #1 Due Wednesday, April 12 Math 395 Homework #1 Due Wednesday, April 12 LaTex is a typesetting system that is widely used by mathematicians. It has the ability to typeset just about any mathematical notation, as well as complex

More information

Getting To Know Matlab

Getting To Know Matlab Getting To Know Matlab The following worksheets will introduce Matlab to the new user. Please, be sure you really know each step of the lab you performed, even if you are asking a friend who has a better

More information

Chapter 1: Introduction to Computers and Java

Chapter 1: Introduction to Computers and Java Chapter 1: Introduction to Computers and Java Starting Out with Java: From Control Structures through Objects Fifth Edition by Tony Gaddis Chapter Topics Chapter 1 discusses the following main topics:

More information

8/23/2014. Chapter Topics. Introduction. Java History. Why Program? Java Applications and Applets. Chapter 1: Introduction to Computers and Java

8/23/2014. Chapter Topics. Introduction. Java History. Why Program? Java Applications and Applets. Chapter 1: Introduction to Computers and Java Chapter 1: Introduction to Computers and Java Starting Out with Java: From Control Structures through Objects Fifth Edition by Tony Gaddis Chapter Topics Chapter 1 discusses the following main topics:

More information

6.170 Laboratory in Software Engineering Java Style Guide. Overview. Descriptive names. Consistent indentation and spacing. Page 1 of 5.

6.170 Laboratory in Software Engineering Java Style Guide. Overview. Descriptive names. Consistent indentation and spacing. Page 1 of 5. Page 1 of 5 6.170 Laboratory in Software Engineering Java Style Guide Contents: Overview Descriptive names Consistent indentation and spacing Informative comments Commenting code TODO comments 6.170 Javadocs

More information

Slide Set 2. for ENCM 335 in Fall Steve Norman, PhD, PEng

Slide Set 2. for ENCM 335 in Fall Steve Norman, PhD, PEng Slide Set 2 for ENCM 335 in Fall 2018 Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary September 2018 ENCM 335 Fall 2018 Slide Set 2 slide

More information

EE 301 Signals & Systems I MATLAB Tutorial with Questions

EE 301 Signals & Systems I MATLAB Tutorial with Questions EE 301 Signals & Systems I MATLAB Tutorial with Questions Under the content of the course EE-301, this semester, some MATLAB questions will be assigned in addition to the usual theoretical questions. This

More information

Digital Image Analysis and Processing CPE

Digital Image Analysis and Processing CPE Digital Image Analysis and Processing CPE 0907544 Matlab Tutorial Dr. Iyad Jafar Outline Matlab Environment Matlab as Calculator Common Mathematical Functions Defining Vectors and Arrays Addressing Vectors

More information

Operators. Java operators are classified into three categories:

Operators. Java operators are classified into three categories: Operators Operators are symbols that perform arithmetic and logical operations on operands and provide a meaningful result. Operands are data values (variables or constants) which are involved in operations.

More information

Working with JavaScript

Working with JavaScript Working with JavaScript Creating a Programmable Web Page for North Pole Novelties 1 Objectives Introducing JavaScript Inserting JavaScript into a Web Page File Writing Output to the Web Page 2 Objectives

More information

CPS122 Lecture: From Python to Java last revised January 4, Objectives:

CPS122 Lecture: From Python to Java last revised January 4, Objectives: Objectives: CPS122 Lecture: From Python to Java last revised January 4, 2017 1. To introduce the notion of a compiled language 2. To introduce the notions of data type and a statically typed language 3.

More information

Finding, Starting and Using Matlab

Finding, Starting and Using Matlab Variables and Arrays Finding, Starting and Using Matlab CSC March 6 &, 9 Array: A collection of data values organized into rows and columns, and known by a single name. arr(,) Row Row Row Row 4 Col Col

More information

AMS 27L LAB #2 Winter 2009

AMS 27L LAB #2 Winter 2009 AMS 27L LAB #2 Winter 2009 Plots and Matrix Algebra in MATLAB Objectives: 1. To practice basic display methods 2. To learn how to program loops 3. To learn how to write m-files 1 Vectors Matlab handles

More information

Chapter 1 Introduction to MATLAB

Chapter 1 Introduction to MATLAB EGR115 Introduction to Computing for Engineers Introduction to MATLAB from: S.J. Chapman, MATLAB Programming for Engineers, 5 th Ed. 2016 Cengage Learning Topics Introduction: Computing for Engineers 1.1

More information