
CSE 152 Assignment 0
Getting acquainted with Matlab
Spring 2005
Due Thursday, April 7
The purpose of this assignment is to gain some familiarity with Matlab programming. Matlab
is intuitive and easy to use! Even if you don’t understand a command or a feature of the language,
you can simply consult the reference manual that comes with the program.
Part 1 Print out the Matlab tutorial portion of the assignment and check each section off once you
have completed it. You should not turn in any Matlab output. You may also make comments
next to any portion that caused you trouble, or to make suggestions that would be useful for
future revisions of the tutorial.
Part 2 Make your own artistic album cover! Using your newfound Matlab skills, write a program
that does the following:
•Read in an image
•Resize the image to 256 ×256 pixels using bilinear interpolation
•Tile the image to form 4 quadrants, where
◦The top left quadrant is the original image
◦The top right is the red channel of the original image
◦The bottom left is the green channel
◦The bottom right is the blue channel
Test your program with the given image flag.jpg. Your program should be short (5 to 10
lines), and your result should match Figure 1. Interpret your results: does your program
produce the correct output? Does the red / green / blue channel separation make sense?
Why? Write a brief explanation / justification.
Finally, try running your program with a picture of your face! (Note that if your image
dimensions are not square, the resulting picture may be distorted, so you may want to crop
the image appropriately.) Turn in a copy of the source image and the final result with the
assignment.
What to hand in
•A hardcopy of the completed tutorial, your Part 2 writeup, your Matlab code, and both pairs
of images (source & result).
•Gather your Matlab source code and your results in a zip file, and attach it to an email
1