This preview shows page 1. Sign up to view the full content.
Unformatted text preview: % built-in Matlab function to calculate the value based on the vector % itself. vSum = sum(vec) % (c) Calculate the mean of the vector "vec" two ways. First, use a % built-in Matlab function to find the mean of "vec", and store your % answer in a variable called "mean1". Then, use the results from % parts (a) and (b) to calculate the mean of "vec", and store your % answer in the variable "mean2". mean1 = mean(vec) mean2 = vSum/vLength % (d) Create a variable called "vProd" that holds the product of the % elements in vector "vec". You should use a built-in Matlab function % to calculate the value based on the vector itself. vProd = prod(vec)...
View Full Document
- Fall '08