Homework 4 - COMS W3101-6 (CVN): Homework 4

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
COMS W3101-6 (CVN): Homework 4 http://www.cs.columbia.edu/~pblaer/matlab-cvn/hw4.html 1 of 4 4/8/2008 10:25 PM COMS W3101-6 (CVN) Spring 2008 Homework 4 Worth 15% of the total grade. If you are using one of the lab workstations you will need to change MATLAB's "Current Directory" to a directory that you have permission to write to. Use the "Current Directory" window to select a directory (if it is not visible, go the "windows" menu at the top of the MATLAB desktop and select "Current Directory"). If you have a USB memory stick, choose the memory stick as the current directory, if not select "D:\My Documents". For this assignment you will write a script m-file called hw4.m . There are multiple exercises in this assignment, be sure to label your solution to each exercise with a comment. Some of the exercises ask for additional script m-files that will be called from within hw4.m . Please include your name and CUNIX ID in a comment at the top of all of your script m-files. Exercises: Write a script called 'prob1.m' that solves for the variables y, and z in terms of a user inputed x. The variables y and z are defined as follows: y = x - 30 when 0 < x < 100 = 0.20*x + 800 when x > 100 = -50 otherwise z = -1 when x < 0 = 0 when x = 0 = 1 when x > 0 Your script should prompt the user to input a value of x (use the input function). Next it should compute the values of y and z (surpress the output at first). Finally it should explicitly display the values of x, y, and z. From with the 'hw4.m' script call 'prob1.m'. 1. Write a script called 'prob2.m' that asks the user if they wish to clear the variables in the workspace. If the user responds with the strings 'y' or 'yes' then the workspace should be cleared. After the workspace is cleared the script should display the string 'Workspace cleared.' If the user responds with the strings 'n' or 'no' then the work space should not be cleared and the script should display the string 'Workspace not cleared.' If the user enters anything else, the script should say that the 'Input was not understood.'
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 4

Homework 4 - COMS W3101-6 (CVN): Homework 4

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online