**Note:**since the whole class is based on MATLAB, it is very important that you spend time in the first few weeks of class familiarizing yourself with MATLAB and going through the recommended tutorials.

**Introduction to MATLAB**- Start a MATLAB session (consult the class Web page on MATLAB resources to find machines on campus with MATLAB). Just click on the MATLAB icon and a MATLAB window should come up, or find MATLAB under Start->Programs->MATLAB. The "command line" prompt (>>), where you can enter commands, is usually the window on the right hand side.
- Select "MATLAB help" under the "help" menu. Under the "Contents" tab select "MATLAB -> Getting Started". If your version of MATLAB does not have online help, or if you are using Octave, you can access this tutorial material in a PDF file, Getting Started with MATLAB (you may want to download this PDF and look at it offline at times when you don't have access to the MATLAB software).
- Go through each of the following items in detail (under
the menu item "Getting Started").. It is strongly recommended that you
interactively try out some of the commands that are described in the
command window as you read this tutorial material.

- Introduction
- Matrices and Arrays

- Programming
(you can skip "Other Data Structures" if you wish - we will return to
this in a later assignment)

- Desktop Tools and Development Environment
- There is a vast range of
documentation available for MATLAB under "Help" - you are not expected
to read all of this! But you do need to go through the basic tutorial
material above to get started. The sooner you have a good understanding
of how to use MATLAB, the more likely you are to do well in assignments
and in your project in this class.

- In addition to the "Getting Started" items, you may also find it useful to refer to some of the more detailed information under other menu items under Contents->MATLAB, such as
- Desktop Tools and Development, e.g. Workspace, Search Path, and File Operation, and Editing and Debugging M-files
- Programming, e.g., Data Structures, Data Types, Basic
Program Components, M-File Programming, and Programming Tips

- Online MATLAB Tutorial
- Go through the "On-Ramp" part of the
*MATLAB tutorial at Mathworks*. This requires registration at the Mathworks site and will take you approximately 30 minutes to go through the whole tutorial. You should have a MATLAB window open as you go through the tutorial so that you can pause the tutorial and try out the ideas directly in MATLAB. You may also want to wear headphones if running the tutorial in a public location like a lab, since the tutorial comes with sound. - (Optional) you may also want to try the
*MATLAB for Problem Solving Tutorial*, which takes about 60 minutes to go through. In particular you may want to look at Tutorial 8, on writing MATLAB programs, since this will help you with Homework 1.

- Note that there are many other online tutorials that you can also look at for additional information. Also there are quite a few introductory books on MATLAB, where the first few chapters typically contain basic tutorial material.

- You are asked to write 3 MATLAB functions below. Before you
tackle this part of the assignment you need to make sure to first
review the basic tutorial above and also make sure to look at the
demo/information Desktop Tools and Development Environment under
"demos".

**Criteria for grading:**when we grade your code we will take into account the following factors:**Correctness of the code:**does the MATLAB function compute the correct solutions under a variety of test conditions. You should make sure you code works for different cases, e.g., different sizes of matrices and vectors.**Comments and clarity**: is the code readable? does it have clear comments? are sensible variable names used? Code that is not clear and/or that is without comments will lose points.**Error-checking**: if a user provides incorrect inputs to the function, does the function halt and generate a meaningful error message? you should include some basic error checking in your code, such as checking for example that the 2 vectors provided to the euclidean.m function have the same dimensions.

- You can use existing MATLAB library functions in the code that
you write, e.g., functions like max( ) or sort( ).

**MATLAB Coding Exercise 1:**Write a MATLAB function (stored as an ascii text file, with the name euclidean.m) that takes 2 vectors (of any length, both the same length) and calculates the Euclidean distance between them. Your function header should have the following format:

function dist = euclidean(x,y)

% function dist = euclidean(x,y)

%

% Calculates the Euclidean distance between two vectors x and y

% Your Name, CS 175, Fall 2007

%

% Inputs:

% x, y: 2 vectors of real numbers, each of size 1 x n

%

% Outputs:

% dist: the Euclidean distance between x and y

------ Your code goes here ------

function [y, i, d] = nearest_neighbor(x, A);

% function [y, i, d] = nearest_neighbor(x, A);

%

% brief description of function here

% Your Name, CS 175, Fall 2007

%

% Inputs

% x: a vector of numbers of size 1 x n

% A: k vectors of size 1 x n, "stacked" in a k x n matrix

%

% Outputs

% y: the closest vector in A to x (y has size 1 x n)

% i: the integer (row) index of y in A

% d: the Euclidean distance between y and x

-------- Your code goes here -------

function [maxvalue, rmax, cmax] = maxvalue(A);

% function [maxvalue, rmax, cmax] = maxvalue(A);

% brief description of function here

% Your Name, CS 175, Fall 2007

%

% Inputs

% A: a matrix of size r x c, with r rows and c columns

%

% Outputs

% maxvalue: largest entry in A

% rmax, cmax: integers specifying the (row,column) location of the max value

-------- Your code goes here -------

- MATLAB, Face recognition technology was introduced in consumer cameras a few years ago and is now widely available. Write about 1 page (acceptable formats are Word, PDF, or a plain ascii text file) where you discuss the following points (you can use the Web or any other source of information to find background information):
- is face recognition considered to be a success in consumer cameras?
- how does face recognition enhance the consumer's picture-taking abilities? i.e., what can you do with face-recognition on a camera that could not be done before?
- what are the limitations of face recognition in cameras? e.g., are there situations where it does not work well?
- how do the algorithms work? there seems to be relatively little published on this - the camera companies like to keep their algorithms secret so as not to provide competitive advantage to their competitors - but if you can find any information on the details of how the algorithms work, please provide a brief summary and a pointer to the source of your information. If you can't find any information on the details of the algorithms, just say so.

- Electronically submit (using the Homework 1 dropbox for CS 175 in EEE)
your MATLAB code for the 3
functions above and your writing assignment. The MATLAB files should be called euclidean.m, nearest_neighbor.m, and maxvalue.m