next up previous
Next: About this document ...

ESC 251 HW 7 Due: Sep. 19

You should hand in printouts of your MATLAB functions and the testing process. You can either write a script to test your functions or do your testing at the command line.

1)
(2 pts) Write your own MATLAB function to compute the area of a circle given the diameter. As a starting point, the first line in your function should look like
     function [area] = circle_area(d)
Test your program using d = 1.4.
2)
(5 pts) Write a function that will take the x and y-coordinates of a point in the x-y plane as input and return the coordinates of the point in polar coordinates. This function will have two inputs (x and y) and two outputs (a radius and an angle in radians).

Test your function using the points (1,1), (-1,1) and (-3,-4). Be sure to check your answers.

3)
(3 pts) Write a function that will compute the Pearson correlation coefficient given two vectors of x and y coordinates (note that 90% of this problem is already done for you). Test your function on the data in the testdata.dat file from the last class.




2018-09-17