Sie sind auf Seite 1von 4

Experiment No.

2
Aim: To generate and sketch basic and complex Continuous-time and Discrete-time Signals. Theory: The Signals, which are functions of one or more independent variables, contain information about the behaviour or nature of some phenomenon. Independent variables may be time, space etc. depending on type of signals. Some examples are: a speech signal would be mathematically represented by acoustic pressure as a function of time, Voltage, current or power as functions of time, a monochromatic picture can be described as a signal which is mathematically represented by brightness as a function of two spatial variables, The purpose of this lab is the introduction of the graphical representation of elementary as well as Complex Signals. For this Lab, our focus will be on a single (1-D) independent variable which we call time. Depending on time, signals can be classified into continuous and discrete-time signals used in linear systems. It is important to emphasize that. A continuous-time signal takes on a value at every point in time, whereas a discrete-time signal is only defined at integer values of the time variable. However, while discrete-time signals can be easily stored and processed on a computer, it is impossible to store the values of a continuous-time signal for all points along a segment of the real line. How then do we process continuous-time signals? In this lab, we will see that continuous- time signals may be processed by first approximating them by discrete-time signals using a process known as sampling. We will see that proper selection of the spacing between samples is crucial for an efficient and accurate approximation of a continuous-time signal. Excessively close spacing will lead to too much data with not much improvement in signal representation, whereas excessively distant spacing will lead to a poor approximation of the continuous-time signal. 2. Continuous-Time Vs. Discrete-Time Signals The representation of continuous-time signals on a computer depends on sampling process. Selection of the sampling interval decides the precision of graphical representation of CT signal by discrete values. To display CT and DT signal on MATLAB see plot, stem, subplot commands. It is common to graph a discrete-time signal as dots in a Cartesian coordinate system. This can be done in the Matlab environment by using the stem command. We will also use the subplot command to put multiple plots on a single figure. Start Matlab on your workstation and type the following sequence of commands in a script file. 1 % Generate discrete-time sinusoidal signal 2 n = 0: 2: 60; 3 y = sin(n/6); 4 subplot(3,1,1) 5 stem(n, y)

This plot shows the discrete-time signal formed by computing the values of the function sin (n/6) at points which are uniformly spaced at intervals of size 2. Notice that while sin(t /6)is a continuous-time function, the sampled version of the signal, sin(n/6), is a discretetime function. A digital computer cannot store all points of a continuous-time signal since this would require an infinite amount of memory. It is, however, possible to plot a signal which looks like a continuous-time signal, by computing the value of the signal at closely spaced points in time, and then connecting the plotted points with lines. The Matlab plot function may be used to generate such plots. Steps for plotting continuous time signals are as follows: 1). Assign the value dt very small, as per Sampling Theorem. 2). Vary the timet between two points with an increment of dt. Use the following sequence of commands in a script file to generate two continuous-time plots of the signal sin (t/6). 1 % Generate Continuous-time sinusoidal signal 2 t1 = 0:0.1:20, 3 z = sin(t1/6); 4 subplot(3,1,2) 5 plot(t1,z) 6 t2 = 0:1:20; 7 w = sin(t2/6); 8 subplot(3,1,3) 9 plot(t2,w) As you can see, it is important to have many points to make the signal appear smooth. So, the selection of sampling period is critical in getting CT signal smooth, it must be chosen such that smooth plot is obtained at the same with not much large array size with not much improvement in graphical representation of CT signal. For given CT signal, Steps for converting CT signal to the DT signal are as follows: 1) Assign the value of sampling time, T. 2) Vary the time integer n between two integer points with an increment of 1. 3) The discrete version can be obtained as: y (n) = y(nT).

IN LAB EXERCISE Basic CT Signals and DT Signals Q1. Plot the following continuous-time functions over the specified intervals. Write single script files for all CT signals with name CTsignals_GroupNo. X.m. Use the plot and figure command, and be sure to label the time axes. (a) Unit Impulse function, x1 (t) = (t)

(b) Unit Step function, x2(t) = u (t) for t = [-2, 2] (c) Unit Ramp function, x3(t) = r (t) for t = [-2, 5] (d) sinusoidal function, x4(t) = 3*sin(2*pi*f*t), where f = 20 Hz for t = - 1 to 1 secs (e) Exponential function, x5(t) = e-at for t = [-4, 4] for a= 0.5, 1.5. Comment on the effect of time scaling. (f) rect(t) for t = [ -2 , 2] (g) sinc(t) for t = [-1, 10] Hint: These functions may be computed in Matlab by using a Boolean expression. For example, if t = -10: 0.1: 10, then y = u (t) may be computed using the Matlab command x = t > 0. Q2. Also write another .m - script file to stem the corresponding discrete-time function with name DTsignals_GroupNo. X.m. Use the subplot command to put Q2.a) - c) plots in a figure 1, Q2.d) - e) plots in a figure 2 and Q2.f) - g) plots in a figure 3. Issue the command orient (tall) just prior to printing to prevent crowding of the subplots. Random Signals The objective of this section is to show how two signals generated using same script file and look similar can be distinguished by computing their average over a large interval. Q3. Generate two discrete-time signals called sig1 and sig2 of length 1, 000. The samples of sig1 should be independent, Gaussian random variables with mean 0 and variance 1. The samples of sig2 should be independent, Gaussian random variables with mean 0.2 and variance 1. Use random or randn to generate these signals, and then plot them in a same figure. (An alternative name for a Gaussian random variable is a normal random variable.) Next form a new signal ave1(n) of length 1, 000 such that ave1(n) is the average of the vector sig1(1:n) (the expression sig1(1:n) returns a vector containing the first n elements of sig1). Similarly, compute ave2(n) as the average of sig2(1:n). Plot the signals ave1(n) and ave2(n) versus n on a same plot. Comment on how the average values changes with n. POST LAB EXERCISE Q1.Generate the waveform of following signals: For CT signals, t = is -10 to 10 sec Take appropriate value of sampling interval. (a) (b) (c) (d) (e) (f) xa(t) = (t + 1) xb(t) = (t + 1/2) (t - 1/2) xc(t) = t u(t) xd(t) = u (t + 2) u(t - 5) xe(t) = r (t +1) r (t) + r (t - 2) xf(t) = exp(-t) sin(2t) + exp(-t/2) cos(5 t)

Q2. For DT signals, n = -5 to 5 samples a. b. c. d. e. f. xa[n] = r[-n] xb[n] = exp(n-1) xc[n] = [n - 1] [n - 2] xd[n] = u [n + 1] 2u[ n] + u [n-1] xe[n] = r [n + 3] r [n - 3] xf [n] = an cos(2 n)

Q3. Sketch the waveform:

b. Using the result of part (a), compute the derivative of v(t), and sketch its waveform. Q4. Sketch the waveform:

Das könnte Ihnen auch gefallen