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

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 5 http://www.cs.columbia.edu/~pblaer/matlab-cvn/hw5.html 1 of 4 4/8/2008 10:25 PM COMS W3101-6 (CVN) Spring 2008 Homework 5 Worth 15% of the total grade. For this assignment you will write a script m-file called hw5.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 hw5.m. Please include your name and CUNIX ID in a comment at the top of all of your script m-files. Exercises: Write a function called "findstats" (in function m-file "findstats.m") that takes a variable number of input arguments and returns exactly three output arguments: The average (a single, scaler number) of all the elements of all the input variables (not just the separate averages of each column of each variable). 1. The median value of all the elements of all the input variables (a single, scaler number). 2. The standard deviation of all the elements of all the input variables (a single, scaler number). 3. If there are no input arguments given to the function, have the program throw an error. Be sure to properly comment your function. In 'hw5.m' execute findstats on various inputs that demonstrates your function (including no input, to demonstrate your error handling). 1. Put the solution to this problem in 'hw5.m' The present value of an annuity (a yearly sum of money) may be computed from the formula: P = (A/i) [(1 + i) n - 1]/(1 + i) n where A is the annuity (in $/year), i is the nominal yearly interest rate (in decimal form), n is the number of years over which the annuity is paid and P is the present value ($). Example computation: If i = 0.15 (15%), A = $100/year and n = 10 years then P = $501.88. a. Set a function handle "present_value" equal to an anonymous function that solves for P in terms of A, n and i. Verify that it works for the above example. b. Create an inline function called "present_value_inline" that performs the same operation as in part a.
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.

This note was uploaded on 08/05/2008 for the course COMS W3101 taught by Professor Blaer during the Spring '08 term at Columbia.

Page1 / 4

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

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