COMS W31016 (CVN): Homework 5
http://www.cs.columbia.edu/~pblaer/matlabcvn/hw5.html
1 of 4
4/8/2008 10:25 PM
COMS W31016 (CVN) Spring 2008
Homework 5
Worth 15% of the total grade.
For this assignment you will write a script mfile 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 mfiles 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 mfiles.
Exercises:
Write a function called "findstats" (in function mfile "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.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview.
Sign up
to
access the rest of the document.
 Spring '08
 Blaer
 Inverse function, sampling rate, State Lottery, Paul Blaer

Click to edit the document details