Homework #2: Introduction to Images Due 4 th Week of Spring 2018 at the start of lab CSE 7, Spring 2018

Size: px
Start display at page:

Download "Homework #2: Introduction to Images Due 4 th Week of Spring 2018 at the start of lab CSE 7, Spring 2018"

Transcription

1 Homework #2: Introduction to Images Due 4 th Week of Spring 2018 at the start of lab CSE 7, Spring 2018 Before beginning this homework, create a new Notepad++ file in your cs7sxx home directory on ieng6 to record your answers to the Questions. Save as H2_LastName.txt just like in Homework#1. STEP 0: 1. In this homework assignment, we will be working with images in MATLAB. In the most recent lab, we used the imread() function to get a three-dimensional matrix representing the image. Here are some examples illustrating how we can work with images in MATLAB (i.e., you should try to execute these commands with the appropriate setup but it is optional). The variable img will be a 3D matrix of size [height of kitten.jpg ] x [width of kitten.jpg ] x 3 (in that order). Figure 1 shows what the original image looks like. >> imshow(img); To display the matrix img as a picture, we will use the function imshow(). >> blueval = img(20, 55, 3); To access the individual elements of the matrix, we will state the variable name and three indices (or index ranges) of the matrix. In the code above, it is looking at the matrix variable img, specifically the element at the 20 th row, 55 th column, and 3 rd floor. Recall that for image matrices, the floors correspond to the red, green, or blue color values. So, to get the red or green values, we will just specify 1 or 2 (respectively) rather than 3 for the blue value (remember RGB!). Question #1: What is the code to obtain the red value of the pixel at row 20, column 30 of an image matrix called img and assign to a variable called redval? Question #2: What is the code to obtain all of the values pertaining the green values? (Hint: this means to obtain all the values in the 2nd dimension) Question #3: What is the code to obtain the blue values of the last row? >> new_img2 = img(1:end, 1:2:end, :); MATLAB allows the syntax where if we put a value in between the range, it will change the step size. For example, in the code above, we are accessing the columns from 1 to the end in steps of 2, i.e., every other column. So, we look at the variable img and look at all the rows (1:end), every other column, and all the colors. Then, we save these elements of img as a new variable called new_img2. Refer to Figure 3 for the resulting image

2 EXAMPLE: a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18] >> a(1:4:16) (try it yourself) >> new_img3 = [img, img]; MATLAB will also allow creating a matrix of matrices as well. The code above, places the two matrices right next to each other and saves the resulting matrix new_img3 as new_img3. img img Question #4: Instead of placing a comma between the two img variables, try it with a semicolon what happens, and why? STEP 1: 1. Choose an image that you would like to work for this assignment. Preferably a mediumsized one, rather than one that takes up the entire screen or one that is too tiny. It would be fun to use something that shows your own interests, but any image is fine as long as it is appropriate for a school/workplace environment (i.e. not offensive) a. Save your image into the folder where you keep your MATLAB scripts. You should see the name of your image file appear in the file list. Also, save a copy of the original image in your cs7sxx home directory 2. Create a new script called Crop.m. a. The first line of your script should be: img = imread(filename); b. This line imports filename as a matrix of numbers which MATLAB can then interpret into an image. The matrix representing the image is called img. Notice that the script uses the variable filename, so you will need to set filename to something in the Command Window before you run the script (i.e., c. Save your script (just one line of code so far). 3. In the Command Window, run your script by typing these lines: a. Make a variable named filename and assign it a string that is the name of your file. Note that the image file that you assigned to the variable filename now appears in the Workspace. b. Now call the script, and use the imshow function to show your image. Remember that img is the variable created in Crop that is a matrix of numbers representing the picture.

3 >> Crop >> imshow(img); c. You should see a window open within MATLAB that shows your image. Check to see that you see your image and everything seems to be working. d. If you examine the contents of the image matrix by double-clicking it in the Workspace, you will see that it is a matrix of numbers between 0 and 255. Important! For EVERY script you write, your code must work for whatever image file is input with filename. So you should not "hard-code" (write explicitly) any values such as the size of the matrix (instead, use "end"). 4. Now that we've checked that you can open and view images, let's finish our Crop script. Open the Crop script. a. Create a variable named cropped_img that will hold a cropped image made from the bottom two thirds of the original image. b. This is done using matrix indexingcropping img will be similar to what is being done below. However, we show you how we cropped a picture in half columnwise. >> new_img1= img(1:end/2, 1:end, :); This line of code saves a portion of the matrix called img as a new matrix called new_img1. The specific portion of img that is copied is specified by the indices inside the parentheses. 1:end/2 accesses the rows starting at 1 and going to end/2, which is the top half rows of the image. 1:end accesses the columns from 1 to the end. : accesses all the floors, so all of the RGB color values. If we didn t take all 3 color values, the coloring in our image would change. How can this be adapted to crop only the last two thirds of the image instead of half? i. First, create a new variable called num_of_rows that will hold the number of rows in your image img. ii. Now that you have a variable that holds the number of rows in your image, how can you calculate the index of starting row needed for the cropped image? Store the new number of rows into a variable called new_rows. (Hint: the new image starts from 1/3 of the total rows) iii. Apply what you learned in Step 0 to crop img and store it into your variable cropped_img. (Hint: access the rows from new_rows to end)

4 c. Here is what the image looks like before and after the crop:

5 Original Cropped Image STEP 2: Note: You may get a warning that looks like: Warning: Integer operands are required for colon operator when used as index > In Crop (line 2) In this case, you need to convert a double (real) number to an integer. For example, if the height of your image is 215 rows, you won't be able to select the rows on the right! You need an integer instead of a fractional number of rows. To do this, you can use the floor function. It takes in a number as an argument, and returns that number rounded down to an integer. You can try floor in the Command Window on simple examples to get the feeling for it: >> floor(215/2) ans =??? >> floor(2.7) ans =??? >> floor(2) ans =??? Question #5: When you are finished testing your Crop script, copy and paste all the commands into your Notepad++ document. Save the cropped_img image as cropped_img1.jpg. 1. Make another script, Squish.m that uses the original image. In the script, create a shortpic as an output variable, where shortpic contains every other row of original img. 2. Now within the same script, using the variable shortpic, create a variable squished_img that will hold a new image made up of two shortpic images placed next to each other (horizontal). Question #6: When you are finished editing your Squish script, copy all commands into

6 your Notepad++ document. Save the squished_img image as squished_img1.jpg. Your squished_img should look similar to this: STEP 3: 1. Make a script called Stretch.m that uses the original image. In the script, create a tallpic as an output variable, where tallpic contains every other column of original img. 2. Now within the same script, using the variable tallpic, create a variable fourgrids_img that will hold a new image made up of four tallpic images. Two stacked on top of the other two images. (Hint: How can you modify what you did in Step 2 to place the images together vertically and horizontally?) Question #7: When you are done testing your Stretch script, copy all commands into your Notepad++ document. Save the fourgrids_img image as fourgrids_img1.jpg. Your fourgrids_img1 will look something like this:

7 Important! In Lab #2, you learned how to comment a script using the percent sign %. Starting with Homework #2, you are expected to comment at least one of your scripts (although it is good practice to comment every script you write!) for EVERY HOMEWORK ASSIGNMENT. At least one of your scripts in every homework must include (1) a header comment including your name, the name of the script, and a description of what the script does. (2) a brief description of every function you call in this script, this includes the input and output arguments. (3) any additional comments necessary to clarify the logic you used in your code. You do NOT have to copy your comments into your Notepad++ document. Example: **Don t forget to stay within the 80 column limit! ** STEP 4: 1. Run all your scripts on the image you selected in Step #1 above, as well as kitten.jpg which is provided on website. Testing your code with two images is a way to see if your code is input-flexible. 2. Images Needed for Checkoff document: In order to get checked off, you will need 8 images in YOUR cs7sxx folder. 1) Unmodified image 1 2) Result of Crop script on image 1 (cropped_img1.jpg) 3) Result of Squish script on image 1 (squished_img1.jpg) 4) Result of Stretch on image 1 (fourgrids_img1.jpg) 5) Unmodified image 2 6) Result of Crop script on image 2 (cropped_img2.jpg) 7) Result of Squish script on image 2 (squished_img2.jpg) 8) Result of Stretch on image 2 (fourgrids_img2.jpg) You can save your images by going to File->Save As on the window that opens when you run imshow(cropped_img). PLEASE CHOOSE TO SAVE YOUR IMAGES AS JPG/jpg format. Paste the script code for all three scripts into your Notepad++ document. Clearly label the scripts as indicated in the instructions.

Lab 4 CSE 7, Spring 2018 This lab is an introduction to using logical and comparison operators in Matlab.

Lab 4 CSE 7, Spring 2018 This lab is an introduction to using logical and comparison operators in Matlab. LEARNING OBJECTIVES: Lab 4 CSE 7, Spring 2018 This lab is an introduction to using logical and comparison operators in Matlab 1 Use comparison operators (< > = == ~=) between two scalar values to create

More information

Matlab notes Matlab is a matrix-based, high-performance language for technical computing It integrates computation, visualisation and programming usin

Matlab notes Matlab is a matrix-based, high-performance language for technical computing It integrates computation, visualisation and programming usin Matlab notes Matlab is a matrix-based, high-performance language for technical computing It integrates computation, visualisation and programming using familiar mathematical notation The name Matlab stands

More information

Introduction to MATLAB

Introduction to MATLAB Introduction to MATLAB Introduction: MATLAB is a powerful high level scripting language that is optimized for mathematical analysis, simulation, and visualization. You can interactively solve problems

More information

CS1114: Matlab Introduction

CS1114: Matlab Introduction CS1114: Matlab Introduction 1 Introduction The purpose of this introduction is to provide you a brief introduction to the features of Matlab that will be most relevant to your work in this course. Even

More information

Computer Vision. Matlab

Computer Vision. Matlab Computer Vision Matlab A good choice for vision program development because Easy to do very rapid prototyping Quick to learn, and good documentation A good library of image processing functions Excellent

More information

Digital Image Processing

Digital Image Processing Digital Image Processing Introduction to MATLAB Hanan Hardan 1 Background on MATLAB (Definition) MATLAB is a high-performance language for technical computing. The name MATLAB is an interactive system

More information

CS1114: Matlab Introduction

CS1114: Matlab Introduction CS1114: Matlab Introduction 1 Introduction The purpose of this introduction is to provide you a brief introduction to the features of Matlab that will be most relevant to your work in this course. Even

More information

MAT 343 Laboratory 1 Matrix and Vector Computations in MATLAB

MAT 343 Laboratory 1 Matrix and Vector Computations in MATLAB MAT 343 Laboratory 1 Matrix and Vector Computations in MATLAB In this laboratory session we will learn how to 1. Create matrices and vectors. 2. Manipulate matrices and create matrices of special types

More information

Class #1. introduction, functions, variables, conditionals

Class #1. introduction, functions, variables, conditionals Class #1 introduction, functions, variables, conditionals what is processing hello world tour of the grounds functions,expressions, statements console/debugging drawing data types and variables decisions

More information

CS100R: Matlab Introduction

CS100R: Matlab Introduction CS100R: Matlab Introduction August 25, 2007 1 Introduction The purpose of this introduction is to provide you a brief introduction to the features of Matlab that will be most relevant to your work in this

More information

EGR 102 Introduction to Engineering Modeling. Lab 05A Managing Data

EGR 102 Introduction to Engineering Modeling. Lab 05A Managing Data EGR 102 Introduction to Engineering Modeling Lab 05A Managing Data 1 Overview Review Structured vectors in MATLAB Creating Vectors/arrays:» Linspace» Colon operator» Concatenation Initializing variables

More information

Unix Computer To open MATLAB on a Unix computer, click on K-Menu >> Caedm Local Apps >> MATLAB.

Unix Computer To open MATLAB on a Unix computer, click on K-Menu >> Caedm Local Apps >> MATLAB. MATLAB Introduction This guide is intended to help you start, set up and understand the formatting of MATLAB before beginning to code. For a detailed guide to programming in MATLAB, read the MATLAB Tutorial

More information

Matlab for FMRI Module 1: the basics Instructor: Luis Hernandez-Garcia

Matlab for FMRI Module 1: the basics Instructor: Luis Hernandez-Garcia Matlab for FMRI Module 1: the basics Instructor: Luis Hernandez-Garcia The goal for this tutorial is to make sure that you understand a few key concepts related to programming, and that you know the basics

More information

Spring CS Homework 3 p. 1. CS Homework 3

Spring CS Homework 3 p. 1. CS Homework 3 Spring 2018 - CS 111 - Homework 3 p. 1 Deadline 11:59 pm on Friday, February 9, 2018 Purpose CS 111 - Homework 3 To try out another testing function, check-within, to get more practice using the design

More information

Slide 1 CS 170 Java Programming 1 Multidimensional Arrays Duration: 00:00:39 Advance mode: Auto

Slide 1 CS 170 Java Programming 1 Multidimensional Arrays Duration: 00:00:39 Advance mode: Auto CS 170 Java Programming 1 Working with Rows and Columns Slide 1 CS 170 Java Programming 1 Duration: 00:00:39 Create a multidimensional array with multiple brackets int[ ] d1 = new int[5]; int[ ][ ] d2;

More information

CS1114 Assignment 5, Part 1

CS1114 Assignment 5, Part 1 CS4 Assignment 5, Part out: Friday, March 27, 2009. due: Friday, April 3, 2009, 5PM. This assignment covers three topics in two parts: interpolation and image transformations (Part ), and feature-based

More information

CSC 101: PreLab Reading for Lab #4 More HTML (some of this reading on Tables and Images are based on previous writings of Prof William Turkett)

CSC 101: PreLab Reading for Lab #4 More HTML (some of this reading on Tables and Images are based on previous writings of Prof William Turkett) CSC 101: PreLab Reading for Lab #4 More HTML (some of this reading on Tables and Images are based on previous writings of Prof William Turkett) Purpose: The purpose of this pre-lab is to provide you with

More information

Introduction to MATLAB. CS534 Fall 2016

Introduction to MATLAB. CS534 Fall 2016 Introduction to MATLAB CS534 Fall 2016 What you'll be learning today MATLAB basics (debugging, IDE) Operators Matrix indexing Image I/O Image display, plotting A lot of demos... Matrices What is a matrix?

More information

General Information. There are certain MATLAB features you should be aware of before you begin working with MATLAB.

General Information. There are certain MATLAB features you should be aware of before you begin working with MATLAB. Introduction to MATLAB 1 General Information Once you initiate the MATLAB software, you will see the MATLAB logo appear and then the MATLAB prompt >>. The prompt >> indicates that MATLAB is awaiting a

More information

Lab 1 Intro to MATLAB and FreeMat

Lab 1 Intro to MATLAB and FreeMat Lab 1 Intro to MATLAB and FreeMat Objectives concepts 1. Variables, vectors, and arrays 2. Plotting data 3. Script files skills 1. Use MATLAB to solve homework problems 2. Plot lab data and mathematical

More information

Ascii Art. CS 1301 Individual Homework 7 Ascii Art Due: Monday April 4 th, before 11:55pm Out of 100 points

Ascii Art. CS 1301 Individual Homework 7 Ascii Art Due: Monday April 4 th, before 11:55pm Out of 100 points CS 1301 Individual Homework 7 Ascii Art Due: Monday April 4 th, before 11:55pm Out of 100 points Files to submit: 1. HW7.py THIS IS AN INDIVIDUAL ASSIGNMENT! You should work individually on this assignment.

More information

MATH (CRN 13695) Lab 1: Basics for Linear Algebra and Matlab

MATH (CRN 13695) Lab 1: Basics for Linear Algebra and Matlab MATH 495.3 (CRN 13695) Lab 1: Basics for Linear Algebra and Matlab Below is a screen similar to what you should see when you open Matlab. The command window is the large box to the right containing the

More information

Dr Richard Greenaway

Dr Richard Greenaway SCHOOL OF PHYSICS, ASTRONOMY & MATHEMATICS 4PAM1008 MATLAB 3 Creating, Organising & Processing Data Dr Richard Greenaway 3 Creating, Organising & Processing Data In this Workshop the matrix type is introduced

More information

1 Introduction to Matlab

1 Introduction to Matlab 1 Introduction to Matlab 1. What is Matlab? Matlab is a computer program designed to do mathematics. You might think of it as a super-calculator. That is, once Matlab has been started, you can enter computations,

More information

Day 1: Introduction to MATLAB and Colorizing Images CURIE Academy 2015: Computational Photography Sign-Off Sheet

Day 1: Introduction to MATLAB and Colorizing Images CURIE Academy 2015: Computational Photography Sign-Off Sheet Day 1: Introduction to MATLAB and Colorizing Images CURIE Academy 2015: Computational Photography Sign-Off Sheet NAME: NAME: Part 1.1 Part 1.2 Part 1.3 Part 2.1 Part 2.2 Part 3.1 Part 3.2 Sign-Off Milestone

More information

Finding MATLAB on CAEDM Computers

Finding MATLAB on CAEDM Computers Lab #1: Introduction to MATLAB Due Tuesday 5/7 at noon This guide is intended to help you start, set up and understand the formatting of MATLAB before beginning to code. For a detailed guide to programming

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

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

CSE/NEUBEH 528 Homework 0: Introduction to Matlab

CSE/NEUBEH 528 Homework 0: Introduction to Matlab CSE/NEUBEH 528 Homework 0: Introduction to Matlab (Practice only: Do not turn in) Okay, let s begin! Open Matlab by double-clicking the Matlab icon (on MS Windows systems) or typing matlab at the prompt

More information

MATLAB TUTORIAL WORKSHEET

MATLAB TUTORIAL WORKSHEET MATLAB TUTORIAL WORKSHEET What is MATLAB? Software package used for computation High-level programming language with easy to use interactive environment Access MATLAB at Tufts here: https://it.tufts.edu/sw-matlabstudent

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

Desktop Command window

Desktop Command window Chapter 1 Matlab Overview EGR1302 Desktop Command window Current Directory window Tb Tabs to toggle between Current Directory & Workspace Windows Command History window 1 Desktop Default appearance Command

More information

How to learn MATLAB? Some predefined variables

How to learn MATLAB? Some predefined variables ECE-S352 Lab 1 MATLAB Tutorial How to learn MATLAB? 1. MATLAB comes with good tutorial and detailed documents. a) Select MATLAB help from the MATLAB Help menu to open the help window. Follow MATLAB s Getting

More information

ROSE-HULMAN INSTITUTE OF TECHNOLOGY

ROSE-HULMAN INSTITUTE OF TECHNOLOGY EXAM 2 WRITTEN PORTION NAME SECTION NUMBER CAMPUS MAILBOX NUMBER EMAIL ADDRESS @rose-hulman.edu Written Portion / 48 Computer Portion / 52 Total / 100 ROSE-HULMAN INSTITUTE OF TECHNOLOGY USE MATLAB SYNTAX

More information

(Refer Slide Time 01:41 min)

(Refer Slide Time 01:41 min) Programming and Data Structure Dr. P.P.Chakraborty Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture # 03 C Programming - II We shall continue our study of

More information

Image Manipulation in MATLAB Due Monday, July 17 at 5:00 PM

Image Manipulation in MATLAB Due Monday, July 17 at 5:00 PM Image Manipulation in MATLAB Due Monday, July 17 at 5:00 PM 1 Instructions Labs may be done in groups of 2 or 3 (i.e., not alone). You may use any programming language you wish but MATLAB is highly suggested.

More information

Variable Definition and Statement Suppression You can create your own variables, and assign them values using = >> a = a = 3.

Variable Definition and Statement Suppression You can create your own variables, and assign them values using = >> a = a = 3. MATLAB Introduction Accessing Matlab... Matlab Interface... The Basics... 2 Variable Definition and Statement Suppression... 2 Keyboard Shortcuts... More Common Functions... 4 Vectors and Matrices... 4

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

Step by step set of instructions to accomplish a task or solve a problem

Step by step set of instructions to accomplish a task or solve a problem Step by step set of instructions to accomplish a task or solve a problem Algorithm to sum a list of numbers: Start a Sum at 0 For each number in the list: Add the current sum to the next number Make the

More information

APPM 2360 Lab #2: Facial Recognition

APPM 2360 Lab #2: Facial Recognition APPM 2360 Lab #2: Facial Recognition Instructions Labs may be done in groups of 3 or less. You may use any program; but the TAs will only answer coding questions in MATLAB. One report must be turned in

More information

Lab 3. CSE 3, Summer 2010 In this lab you will learn and implement some basic html.

Lab 3. CSE 3, Summer 2010 In this lab you will learn and implement some basic html. Lab 3 CSE 3, Summer 2010 In this lab you will learn and implement some basic html. A. Absolute vs. Relative Addressing A file s pathname is a set of directions to its location. An example of the pathname

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

EOSC 352 MATLAB Review

EOSC 352 MATLAB Review EOSC 352 MATLAB Review To use MATLAB, you can either (1) type commands in the window (i.e., at the command line ) or (2) type in the name of a file you have made, whose name ends in.m and which contains

More information

MATLAB Demo. Preliminaries and Getting Started with Matlab

MATLAB Demo. Preliminaries and Getting Started with Matlab Math 250C Sakai submission Matlab Demo 1 Created by G. M. Wilson, revised 12/23/2015 Revised 09/05/2016 Revised 01/07/2017 MATLAB Demo In this lab, we will learn how to use the basic features of Matlab

More information

CS/NEUR125 Brains, Minds, and Machines. Due: Wednesday, March 8

CS/NEUR125 Brains, Minds, and Machines. Due: Wednesday, March 8 CS/NEUR125 Brains, Minds, and Machines Lab 6: Inferring Location from Hippocampal Place Cells Due: Wednesday, March 8 This lab explores how place cells in the hippocampus encode the location of an animal

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

Array Accessing and Strings ENGR 1181 MATLAB 3

Array Accessing and Strings ENGR 1181 MATLAB 3 Array Accessing and Strings ENGR 1181 MATLAB 3 Array Accessing In The Real World Recall from the previously class that seismic data is important in structural design for civil engineers. Accessing data

More information

R in Linguistic Analysis. Week 2 Wassink Autumn 2012

R in Linguistic Analysis. Week 2 Wassink Autumn 2012 R in Linguistic Analysis Week 2 Wassink Autumn 2012 Today R fundamentals The anatomy of an R help file but first... How did you go about learning the R functions in the reading? More help learning functions

More information

MATLAB GUIDE UMD PHYS401 SPRING 2012

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

CPSC 217 Assignment 3

CPSC 217 Assignment 3 CPSC 217 Assignment 3 Due: Monday November 26, 2018 at 12:00 noon Weight: 7% Sample Solution Length: Approximately 120 lines, including blank lines, lots of comments and the provided code Individual Work:

More information

Practical 4: The Integrate & Fire neuron

Practical 4: The Integrate & Fire neuron Practical 4: The Integrate & Fire neuron 2014 version by Mark van Rossum 2018 version by Matthias Hennig and Theoklitos Amvrosiadis 16th October 2018 1 Introduction to MATLAB basics You can start MATLAB

More information

MATLAB Project: Getting Started with MATLAB

MATLAB Project: Getting Started with MATLAB Name Purpose: To learn to create matrices and use various MATLAB commands for reference later MATLAB functions used: [ ] : ; + - * ^, size, help, format, eye, zeros, ones, diag, rand, round, cos, sin,

More information

1 Getting started with Processing

1 Getting started with Processing cis3.5, spring 2009, lab II.1 / prof sklar. 1 Getting started with Processing Processing is a sketch programming tool designed for use by non-technical people (e.g., artists, designers, musicians). For

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

Introduction to MATLAB

Introduction to MATLAB Introduction to MATLAB MATLAB stands for MATrix LABoratory. Originally written by Cleve Moler for college linear algebra courses, MATLAB has evolved into the premier software for linear algebra computations

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

Getting started with MATLAB

Getting started with MATLAB Getting started with MATLAB You can work through this tutorial in the computer classes over the first 2 weeks, or in your own time. The Farber and Goldfarb computer classrooms have working Matlab, but

More information

An Introduction to Matlab5

An Introduction to Matlab5 An Introduction to Matlab5 Phil Spector Statistical Computing Facility University of California, Berkeley August 21, 2006 1 Background Matlab was originally developed as a simple interface to the LINPACK

More information

Lecture Programming in C++ PART 1. By Assistant Professor Dr. Ali Kattan

Lecture Programming in C++ PART 1. By Assistant Professor Dr. Ali Kattan Lecture 08-1 Programming in C++ PART 1 By Assistant Professor Dr. Ali Kattan 1 The Conditional Operator The conditional operator is similar to the if..else statement but has a shorter format. This is useful

More information

CSC 101: Lab #2 HTML and the WWW Manual and Report Lab Date: Tuesday, 2/2/2010 Report Due Date: Friday, 2/5/2010 3:00pm

CSC 101: Lab #2 HTML and the WWW Manual and Report Lab Date: Tuesday, 2/2/2010 Report Due Date: Friday, 2/5/2010 3:00pm CSC 101: Lab #2 HTML and the WWW Manual and Report Lab Date: Tuesday, 2/2/2010 Report Due Date: Friday, 2/5/2010 3:00pm Lab Report: Answer the report questions in this document as you encounter them. For

More information

Chapter 2 Fundamentals. Chapter 2 Fundamentals The images used here are provided by the authors.

Chapter 2 Fundamentals. Chapter 2 Fundamentals The images used here are provided by the authors. The images used here are provided by the authors. Objectives: Digital Image Representation Image as a Matrix Reading and Displaying Images Writing Images Storage Classes and Data Types Image Coordinate

More information

Array Creation ENGR 1181 MATLAB 2

Array Creation ENGR 1181 MATLAB 2 Array Creation ENGR 1181 MATLAB 2 Array Creation In The Real World Civil engineers store seismic data in arrays to analyze plate tectonics as well as fault patterns. These sets of data are critical to

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

MAT 343 Laboratory 1 Matrix and Vector Computations in MATLAB

MAT 343 Laboratory 1 Matrix and Vector Computations in MATLAB MAT 343 Laboratory 1 Matrix and Vector Computations in MATLAB MATLAB is a computer software commonly used in both education and industry to solve a wide range of problems. This Laboratory provides a brief

More information

Excel Basics Fall 2016

Excel Basics Fall 2016 If you have never worked with Excel, it can be a little confusing at first. When you open Excel, you are faced with various toolbars and menus and a big, empty grid. So what do you do with it? The great

More information

MATLAB Project: Getting Started with MATLAB

MATLAB Project: Getting Started with MATLAB Name Purpose: To learn to create matrices and use various MATLAB commands for reference later MATLAB built-in functions used: [ ] : ; + - * ^, size, help, format, eye, zeros, ones, diag, rand, round, cos,

More information

APPM 2460 Matlab Basics

APPM 2460 Matlab Basics APPM 2460 Matlab Basics 1 Introduction In this lab we ll get acquainted with the basics of Matlab. This will be review if you ve done any sort of programming before; the goal here is to get everyone on

More information

ENGR 1181 MATLAB 05: Input and Output

ENGR 1181 MATLAB 05: Input and Output ENGR 1181 MATLAB 05: Input and Output Learning Objectives 1. Create a basic program that can be used over and over or given to another person to use 2. Demonstrate proper use of the input command, which

More information

Beginner s Mathematica Tutorial

Beginner s Mathematica Tutorial Christopher Lum Autonomous Flight Systems Laboratory Updated: 12/09/05 Introduction Beginner s Mathematica Tutorial This document is designed to act as a tutorial for an individual who has had no prior

More information

New and Improved Formula Editor in JMP 13

New and Improved Formula Editor in JMP 13 These are the step-by-step instructions for the 'New and Improved Formula Editor in JMP 13' demo. This contains talking points and also the demo steps. Demo instructions are underlined and in bold to highlight

More information

Teaching Manual Math 2131

Teaching Manual Math 2131 Math 2131 Linear Algebra Labs with MATLAB Math 2131 Linear algebra with Matlab Teaching Manual Math 2131 Contents Week 1 3 1 MATLAB Course Introduction 5 1.1 The MATLAB user interface...........................

More information

Intro To MATLAB. CS Fall 2013 Zach Welch

Intro To MATLAB. CS Fall 2013 Zach Welch Intro To MATLAB CS 534 - Fall 2013 Zach Welch Overview Basics MATLAB data structures Operations Useful functions Image Processing and other useful things for 534 Demo Q&A Accessing MATLAB MATLAB is available

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

MATLAB Introduction to MATLAB Programming

MATLAB Introduction to MATLAB Programming MATLAB Introduction to MATLAB Programming MATLAB Scripts So far we have typed all the commands in the Command Window which were executed when we hit Enter. Although every MATLAB command can be executed

More information

APPM 2360 Project 2 Due Nov. 3 at 5:00 PM in D2L

APPM 2360 Project 2 Due Nov. 3 at 5:00 PM in D2L APPM 2360 Project 2 Due Nov. 3 at 5:00 PM in D2L 1 Introduction Digital images are stored as matrices of pixels. For color images, the matrix contains an ordered triple giving the RGB color values at each

More information

Array Accessing and Strings ENGR 1187 MATLAB 3

Array Accessing and Strings ENGR 1187 MATLAB 3 Array Accessing and Strings ENGR 1187 MATLAB 3 Today's Topics Array Addressing (indexing) Vector Addressing (indexing) Matrix Addressing (indexing) Today's Topics Array Addressing (indexing) Vector Addressing

More information

Week Two. Arrays, packages, and writing programs

Week Two. Arrays, packages, and writing programs Week Two Arrays, packages, and writing programs Review UNIX is the OS/environment in which we work We store files in directories, and we can use commands in the terminal to navigate around, make and delete

More information

Lab 7: Python Loops and Images 1

Lab 7: Python Loops and Images 1 Lab 7: Python Loops and Images 1 Objectives to use while loops and for loops to further explore image and pixel features to further understand and practice using parameters in functions Copy the Lab 7

More information

1 Overview of the standard Matlab syntax

1 Overview of the standard Matlab syntax 1 Overview of the standard Matlab syntax Matlab is based on computations with matrices. All variables are matrices. Matrices are indexed from 1 (and NOT from 0 as in C!). Avoid using variable names i and

More information

You just told Matlab to create two strings of letters 'I have no idea what I m doing' and to name those strings str1 and str2.

You just told Matlab to create two strings of letters 'I have no idea what I m doing' and to name those strings str1 and str2. Chapter 2: Strings and Vectors str1 = 'this is all new to me' str2='i have no clue what I am doing' str1 = this is all new to me str2 = I have no clue what I am doing You just told Matlab to create two

More information

PHYS 210: Introduction to Computational Physics MATLAB Exercises 2

PHYS 210: Introduction to Computational Physics MATLAB Exercises 2 PHYS 210: Introduction to Computational Physics MATLAB Exercises 2 Using your text editor, and working within /matlab, create a file named ex2.m that contains Matlab commands to solve the exercises enumerated

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

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

Image Processing Toolbox

Image Processing Toolbox Image Processing Toolbox For Use with MATLAB Computation Visualization Programming User s Guide Version 3 1 Getting Started This section contains two examples to get you started doing image processing

More information

MATLAB Introductory Course Computer Exercise Session

MATLAB Introductory Course Computer Exercise Session MATLAB Introductory Course Computer Exercise Session This course is a basic introduction for students that did not use MATLAB before. The solutions will not be collected. Work through the course within

More information

EGR 111 Plotting Data

EGR 111 Plotting Data EGR 111 Plotting Data This lab shows how to import data, plot data, and write script files. This lab also describes the Current Folder, the comment symbol ( % ), and MATLAB file names. New MATLAB Commands:

More information

Matrices 4: use of MATLAB

Matrices 4: use of MATLAB Matrices 4: use of MATLAB Anthony Rossiter http://controleducation.group.shef.ac.uk/indexwebbook.html http://www.shef.ac.uk/acse Department of Automatic Control and Systems Engineering Introduction The

More information

ECE 3793 Matlab Project 1

ECE 3793 Matlab Project 1 ECE 3793 Matlab Project 1 Spring 2017 Dr. Havlicek DUE: 02/04/2017, 11:59 PM Introduction: You will need to use Matlab to complete this assignment. So the first thing you need to do is figure out how you

More information

Lab 3. A Multi-Message Reader

Lab 3. A Multi-Message  Reader Lab 3 A Multi-Message Email Reader Due: Wed. 2/21 at 11PM (for Mon. aft. lab), Thurs. 2/22 at 5PM (for Mon. evening), or Thurs. 2/22 at 11 (for Tues. aft.) The goal in this week s lab is to exercise your

More information

Introduction to Programming for Biology Research

Introduction to Programming for Biology Research Introduction to Programming for Biology Research Introduction to MATLAB: part I MATLAB Basics - The interface - Variables/arrays/matrices - Conditional statements - Loops (for and while) MATLAB: The

More information

Assignment III: Graphing Calculator

Assignment III: Graphing Calculator Assignment III: Graphing Calculator Objective The goal of this assignment is to reuse your CalculatorBrain and CalculatorViewController objects to build a Graphing Calculator. By doing this, you will gain

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

EE168 Lab/Homework #1 Introduction to Digital Image Processing Handout #3

EE168 Lab/Homework #1 Introduction to Digital Image Processing Handout #3 EE168 Lab/Homework #1 Introduction to Digital Image Processing Handout #3 We will be combining laboratory exercises with homework problems in the lab sessions for this course. In the scheduled lab times,

More information

How are groceries, images, and matrices related?

How are groceries, images, and matrices related? How are groceries, images, and matrices related? Joan Gómez Urgellés, PhD Department of Mathematics Polytechnic University of Catalonia EPSEVG Vilanova i la Geltrú. Spain joan.vicenc.gomez@upc.edu How

More information

Matlab Tutorial and Exercises for COMP61021

Matlab Tutorial and Exercises for COMP61021 Matlab Tutorial and Exercises for COMP61021 1 Introduction This is a brief Matlab tutorial for students who have not used Matlab in their programming. Matlab programming is essential in COMP61021 as a

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

Pointers, Arrays and Parameters

Pointers, Arrays and Parameters Pointers, Arrays and Parameters This exercise is different from our usual exercises. You don t have so much a problem to solve by creating a program but rather some things to understand about the programming

More information

6.S189 Homework 1. What to turn in. Exercise 1.1 Installing Python. Exercise 1.2 Hello, world!

6.S189 Homework 1. What to turn in. Exercise 1.1 Installing Python. Exercise 1.2 Hello, world! 6.S189 Homework 1 http://web.mit.edu/6.189/www/materials.html What to turn in Do the warm-up problems for Days 1 & 2 on the online tutor. Complete the problems below on your computer and get a checkoff

More information

6.149 Checkoff 2. What to complete. Recall: Creating a file and running a program in IDLE.

6.149 Checkoff 2. What to complete. Recall: Creating a file and running a program in IDLE. 6.149 Checkoff 2 http://web.mit.edu/6.149/www/materials.html What to complete Due: Wednesday, January 14, 2015 @ 5 p.m. 1. checkoff2 user input.py, which will contain your code for 2.1 - User input 2.

More information

Lab 8. Basic Image Processing Algorithms Fall 2017

Lab 8. Basic Image Processing Algorithms Fall 2017 Lab 8 Basic Image Processing Algorithms Fall 2017 1 Lab 8: Pixel based image segmentation Clustering different images based on pixel data deadline to upload to the SVN server: 23:59, 21/11/2017 2 Last

More information