Lecture 26 User Defined Functions

   

   

   

   

   

   

   

   

   

   

   

   



Tasks:
1. Use an 'user defined function' to find the max value in vector x=[3  4  5  89  0  -3  91  5  6]. (Must have a script file to call the function to solve this problem) No credit will be given if using embedded function max().
2. Use the similar concept to find the minimum value in the same vector.
3. Use the similar concept to find the average value of the same vector.
No credit will be given if using embedded function mean().
4. Use the similar concept to find the max value in
x=[3  4  5;  89  0  -3;  91  5  6]. No credit will be given if using the embedded function max().
5. Redo the following problem using a function called 'appro_pi()' to calculate the value. The error goal is 1e-8, which means when the error is smaller than 1e-8, stop the loop. You must use a script to build the main structure, and a sub-function called 'appro_pi()' to calculate the values.