Question Description

I’m working on a mathlab exercise and need an explanation to help me understand better.

Please help me write the MATLAB code. Please do the sample code. Please read them carefully before accepting the task. Implement a Matlab function that down-samples any discrete signal y(n) with length N to be a down-1. Implement a Matlab function that down-samples any discrete signal y(n) with length N to be a down-

sampled signal, yd(n), with down-sampling rate D. Use the following example to check your function:

y(n) = [1,2,0.5,?0.3,0,0.2,?3,0,2,2.5]

using down sample rate D = 3 yd(n) = [1,?0.3,?3,2.5]

Verify your answer with Matlab function of down-sampling.

2. In one Matlab figure, subplot the following discrete signal y(n), then subplot yd(n) function using your

down-sampling function with D = 5.

y(n) = sin(2 ? n) + sin(4 ? n)

Hint: use for y(n) signal a duration from [0,?] and N = 100 to demonstrate your plot.

3. Implement a Matlab function that up-samples any discrete signal y(n) with length N to be an up-

sampled signal yu(n) with up-sampling rate U. Use the following example to check your function:

y(n) = [1,?0.3,?3,2.5]

using down sample rate U = 3

yd(n) = [1,0,0,?0.3,0,0,?3,0,0,2.5]

Verify your answer with Matlab function of up-sampling.

4. Use the example mentioned in 2 to generate a signal yu(n) by up-sampling the output signal yd(n) with

up-sampling rate U = 5. Re-plot in one figure all the three signals y(n),yd(n), and yu(n).

5. Implement a Matlab function that linearly interpolate any discrete signal y(n) with length N to be an

interpolated discrete signal, yl(n), with interpolation sampling rate I. Use the following example to

check your function: y(n) = [1,?0.5,2]

using interpolate sample rate I = 3

yl(n) = [1,0.5,0.0,?0.5,0.33,1.67,2]

Verify your answer with Matlab linear interpolation function.

6. Implement a Matlab function that does the polynomial interpolation for any discrete signal y(n) with

length N to be an interpolated discrete signal, yp(n), with interpolation sampling rate I and polynomial

order N ? 1. Use the following example to check your function:

y(n) = [1,?0.5,2]

using interpolate sample rate I = 3

yp(n) = [1,0.05,?0.44,?0.5,?0.11,0.72,2]

Verify your answer with Matlab polynomial interpolation function.

7. Use the example mentioned in 2 to generate a two signal yl(n) and yp(n) by interpolating the output

signal yd(n) with interpolating rate I = 5. Re-plot in one figure all the four signals y(n),yd(n), yl(n), and

yp(n).

8. Use any ”.wav” sound file (say:”counting.wav”, search it in matlab folder) and step by step importthe

file in Matlab then use your own functions in one figure to:

(1)-Subplot and play the sound file, make sure you import its frequency sampling rate.

(2)-Subplot and play a down-sampled version of that file with D=10.

(3)-Subplot and play a up-sampled version of that file with U=10.

(4)-Subplot and play a linear interpolated version of the down-sampled signal in (2) file with L=10.

(4)-Subplot and play a polynomial interpolated version of the down-sampled signal in (2) file with

L=10.