# plot continuous and discrete-time signals in Matlab

See attached file for full description:

Activity 1:

Consider the discrete-time signal: x[n] = sin(2*pi*Mn/N), and assume N = 12. For M = 4, 5, and 10, plot x[n] on the interval 0 =< 0 < = 2n - 1. Use stem in Matlab to create your plots, and be sure to approximately label your axes.

Questions: What is the fundamental period of each signal?

Activity 2:

Consider the following two signals:

x1[n] = cos(2*pi*n/N) + 2cos(3*pi*n/N)

x2[n] = cos(pi * n^2/2),

And assume N = 6 for signal x1[n]. Plot each signal separately for the interval of 0 =< n < = 24. Use stem and label your axes.

Questions: are the signals periodic? Explain.

Activity 3:

Consider the following continuous signal:

x(t) = 10exp(-3t)u(t)

Plot the continuous-time signal over the range -1=<t <= 5.

https://brainmass.com/engineering/electrical-engineering/plot-continuous-and-discrete-time-signals-in-matlab-193172

#### Solution Preview

Please see the attached word file for the results.

The codes for the three activities are also attached in the zip file. Unzip the file. ...

#### Solution Summary

The solution shows how to plot continuous and discrete-time signals in Matlab. Matlab codes are plots are included.

Matlab - A discrete-time system has the following unit-pulse response

There are two files which both need completed. Please see attached files for full problem description.

Please be sure to provide code and plots. Thanks.

Lab 2:

1. A discrete-time system has the following unit-pulse response:

h[n] = 0.5^n - 0.25^n, for n >= 0

Correspondingly, the following difference equation describes the behavior of the system:

y[n+2] - 0.75y[n+1] + 0.125y[n] = 0.25x[n+1]

A. Use the MATLAB command conv to calculate the response of the system to

a unit step input, x[n]=u[n]. Consider 0 =< n <= 20. Show what you type into

the MATLAB command window and submit a plot of the output. Please label the axes.

B Use the MATLAB script recur to calculate the response of the system to a

unit step input, x[n]=u[n]. Again consider 0 =< n <= 20. Show all that you type

into the MATLAB command window. Submit a plot of the output with the axes labeled.

Lab 3:

The continuous time function. This signal is a sinc function defined as y(t) = sinc(t). The Fourier transform of this signal is a

rectangle function.

1. Use the function linspace to create a vector of time values from -5 =<t <=5. Next, plot the function using the sinc function for y(t) = sinc(t).

2. Using MATLAB and the command fft, show that the Fourier transform pair is indeed a rectangle function. Use the command fftshift to center your plot.. Show both the m-file code and plot.

3. Using the same time values, plot the continuous time function defined as y(t) = sinc(2t).

4. Plot the transform pair for this signal.

Discussion:

1. What is the "ringing" caused from seen on top of the rectangular pulse?

2. In step 3 above, the sinc function gets compressed or smaller by a factor of 2. What happened to the rectangular pulse in the frequency domain? What property does this relate to?