This preview shows page 1. Sign up to view the full content.
Unformatted text preview: Write a function called overallmax that accepts a matrix as its input argument, and returns a vector containing the maximum value in that matrix. (You just need to return the maximum value, not the location). Use a loop to do this; you cannot use the max function. Computer Question 4: Assume the coefficients of a polynomial are stored as vectors. For example y(x) = x^2+2 is stored as [1 0 2], from highest degree coefficient to least. Write a function called my_poly_eval that accepts two input arguments: a polynomial whose coefficients are stored as a vector, and an x value. You function should calculate the value of the polynomial at that x value. For example, running my_poly_eval( [1 0 2] , 3) yields 11. Hint: Write a for loop that goes through each of the coefficients, and multiplies that coefficient by the appropriate power of x. Note that as you more from left to right in the vector, the powers get smaller ....
View
Full
Document
This note was uploaded on 02/29/2012 for the course 440 127 taught by Professor Blase during the Fall '09 term at Rutgers.
 Fall '09
 blase

Click to edit the document details