[Solved] Assignment 1: CS 215

$25

File Name: Assignment_1:_CS_215.zip
File Size: 188.4 KB

SKU: [Solved] Assignment 1: CS 215 Category: Tag:
5/5 - (1 vote)

Questions:1. Given n values {xi}ni=1 having mean , median and standard deviation , prove that | | . Assumen is even. [10 points]

2. Consider four sets of n values each: {xi}ni=1, {yi}ni=1, {zi}ni=1, {wi}ni=1. Consider for all i, 1 i n, we havezi = axi + b and wi = cyi + d where a 6= 0, c 6= 0. Here a, b, c, d are constants. Then prove that r(z, w) =r(x, y) where r is the correlation coefficient. Comment on when the we would have r(z, w) = r(x, y) andwhen we would have r(x, y) = r(z, w). [10 points]

3. Given n distinct values {xi}ni=1 with mean and standard deviation , prove that for all i, we have |xi| n 1. [10 points]In the following problems, you can use the mean, median and standard deviation functions from MATLAB.

4. Generate a sine wave in MATLAB of the form y = 5 sin(2x + /3) where x ranges from -10 to 10 in steps of0.02. Now randomly select 40 values in the array y (using MATLAB function randperm) and corrupt themby adding random values from 5 to 10 using the MATLAB function rand. This will generate a corruptedsine wave which we will denote as z. Now your job is to filter z using the following steps. Create a new array ymedian to store the filtered sine wave. For a value at index i in z, consider a neighborhood N(i) consisting of z(i), 8 values to its right and 8values to its left. For indices near the left or right end of the array, you may not have 8 neighbors inone of the directions. In such a case, the neighborhood will contain fewer values.1 Set ymedian(i) to the median of all the values in N(i). Repeat this for every i.This process is called as moving median filtering, and will produce a filtered signal in the end. Repeat theentire procedure described here using the arithmetic mean instead of the median. This is called as movingaverage filtering. Plot the original (i.e. clean) sine wave y, the corrupted sine wave z and the filtered sinewave using mean and median on the same figure in different colors. Introduce a legend on the plot (findout how to do this in MATLAB). Include an image of the plot in your report. Now compute and print therelative mean squared error between each result and the original clean sine wave. The relative mean squarederror between y and its estimate y is defined asPi(yi yi)2Piy2i.Now repeat all the steps above when the random values to corrupt the sine wave lay in a range from 100 to120, and include the plot of the sine waves in your report, and write down the relative mean square errorvalues.Which method (median or arithmetic mean) produced better relative mean squared error? Why? Explainin your report. [6+3+3+3=15 points]

5. Suppose that you have computed the mean, median and standard deviation of a set of n numbers stored inarray A where n is very large. Now, you decide to add another number to A. Write a MATLAB functionto update the previously computed mean, another MATLAB function to update the previously computedmedian, and yet another MATLAB function to update the previously computed standard deviation. Notethat you are not allowed to simply recompute the mean and standard deviation by looping through all thedata. You may need to derive a formula for this. Include the formula and its derivation in your report. YourMATLAB functions should be of the form function newMean = UpdateMean (OldMean, NewDataValue, A,N), function newMedian = UpdateMedian (oldMedian, A, N) and function newStd = UpdateStd (OldMean,OldStd, NewMean, NewDataValue, A, N). [5+5+5 = 15 points]

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] Assignment 1: CS 215
$25