Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

Homework 1 (MATLAB Part)

MATLAB Part (To be submitted through NYUClasses. Due date: Sept 12, 11:55PM)

1) 1.1.7 (plotting signals in MATLAB, delta, step, other signals)

2) 1.3.11 (convolution of rectangle functions; rectangle with ramp)

3) Write your own function y=myconv(x,h), which returns the convolution of sequence x and sequence h. Your function should determine the length of x and h, and set the length of y properly. For simplicity, assume that both x and h are zero-valued for n<0, and that they start at n=0. Apply your function to solve problems 1.3.11(a) and 1.3.11(c). Plot the signals x,  h, and y. Compare the  results with those obtained  using  MATLAB conv() function.

You should submit a zip file that contains a report (in .pdf format) which includes the MATLAB code you wrote for each problem, the result for each problem (in terms of plots and necessary discussion), and individual .m files. You could use the“live script”feature of  MATLAB  to  generate  your  report.  Submit  your  zip  file  via  NYUclasses  under “Assignments”.

1.1.7 Plotting diserete-time signals in MATLAB.

Use sten to plot the discrete-time impulse function: 

n= -10:10;

f= (n == 0);

stem (n,f)

Use sten to plot the discrete-time step function:

f (n » 0);

stem (n,f)

Make stem plots of the following signals. Decide for yourself what the range of n should be.

f(n) = u(n) - u(n -4)

g(n) = r(n) - 2r(n - 5) +r(n - 10)   where r(n) := nu(n)

x(n) = δ(n) - 2 δ(n - 4)

y(n) = (0.9)" (น(n) - u(n - 20))

v(n) = cos(0.12 πn) u(n) 

1.3.11 MATLAB conv function

Let

f(n) = u(n) – u(n - 5)

g(n) = r(n) - 2r(n - 5) +r(n -10).

where r(n) := nu(n).

In MATLAB, use theconv function to compute the following convolutions. Use the sten function to plot the results. Be aware about the lengths of the signals. Make sure the horizontal axes in your plots are correct.

(a) f(n) * f(n)

(b) f(n) * f(n) * f(n)

(c) f(n) * g(n)

(d) g(n) * δ(n)

(e) g(n) * g(n)

Comment on your observations: Do you see any relationship between f(n)+f(n) and g(n) ? Compare f(n) with f(n) * f(n) and with f(n) + f(n) + f(n). What happens as you repeatedly convolve this signal with itself?Use the commands title, xlabel, ylabel to label the axes of your plots.