This action might not be possible to undo. Are you sure you want to continue?

Welcome to Scribd! Start your free trial and access books, documents and more.Find out more

1.1 GENERATION OF SEQUENCES Unit sample and unit step sequences

Project 1.1

A copy of Program P1_1 is given below. % Program P1_1 % Generation of a Unit Sample Sequence clf; % Generate a vector from -10 to 20 n = -10:20; % Generate the unit sample sequence u = [zeros(1,10) 1 zeros(1,20)]; % Plot the unit sample sequence stem(n,u); xlabel('Time index n');ylabel('Amplitude'); title('Unit Sample Sequence'); axis([-10 20 0 1.2]); Answers: Q1.1 The unit sample sequence u[n] generated by running Program P1_1 is shown below:

1

9)]. Q1. xlabel('Time index n').3 The modified Program P1_1 to generate a delayed unit sample sequence ud[n] with a delay of 11 samples is given below along with the sequence generated by running this program. % Program P1_1 % Generation of a Unit Sample Sequence 2 .Q1.21) 1 zeros(1. The purpose of axis command is used to control axis scaling and appearance. title('Unit Sample Sequence'). % Plot the unit sample sequence stem(n. The purpose of title command is used to graph title The purpose of xlabel command is used to X-axis label The purpose of ylabel command is used to Y-axis label Q1.ylabel('Amplitude'). % Generate a vector from -10 to 20 n = -10:20.4 The modified Program P1_1 to generate a unit step sequence s[n] is given below along with the sequence generated by running this program.2 The purpose of clf command is used to clear current figure. axis([-10 20 0 1. % Program P1_1 % Generation of a Unit Sample Sequence clf. % Generate the unit sample sequence u = [zeros(1.u).2]).

% Generate a vector from -10 to 20 n = -10:20. % Program P1_1 % Generation of a Unit Sample Sequence clf. xlabel('Time index n').18)].20) ones(1.2]). % Generate the unit sample sequence u = [zeros(1. 3 .13) ones(1.5 The modified Program P1_1 to generate a unit step sequence sd[n] with an advance of 7 samples is given below along with the sequence generated by running this program. axis([-10 20 0 1.u). % Plot the unit sample sequence stem(n.2]). % Generate a vector from -10 to 20 n = -10:20.ylabel('Amplitude'). % Generate the unit sample sequence u = [zeros(1. axis([-10 20 0 1.11)]. % Plot the unit sample sequence stem(n.clf. Q1.ylabel('Amplitude'). xlabel('Time index n').u). title('Unit Sample Sequence'). title('Unit Sample Sequence').

^n.Project 1.ylabel('Amplitude').imag(x)). a = 1. xlabel('Time index n').ylabel('Amplitude').1.1.2. subplot(2. stem(n.2 Exponential signals A copy of Programs P1_2 and P1_3 are given below. xlabel('Time index n'). subplot(2. n = 0:40. K = 2.2).ylabel('Amplitude'). stem(n.2. % Program P1_2 % Generation of a complex exponential sequence clf. % Program P1_3 % Generation of a real exponential sequence clf. stem(n. K = 0.1). x = K*exp(c*n). Answers: 4 . title('Real part'). n = 0:35.x). x = K*a. title('Imaginary part').real(x)). c = -(1/12)+(pi/6)*i. xlabel('Time index n').

8 The result of changing the parameter c to (1/12)+(pi/6)*i is the amplitude will be changed.6 The complex-valued exponential sequence generated by running Program P1_2 is shown below: Q1.7 The parameter controlling the rate of growth or decay of this sequence is n The parameter controlling the amplitude of this sequence is k Q1.Q1. 5 .

11 The real-valued exponential sequence generated by running Program P1_3 is shown below: Q1.13 The difference between the arithmetic operators ^ and .9 The purpose of the operator real is used to extract the real value of a complex number The purpose of the operator imag is used to extract the image value of a complex number Q1.^ is denotes array power Q1. Q1.12 The parameter controlling the rate of growth or decay of this sequence is n The parameter controlling the amplitude of this sequence is k Q1.Q1.14 The sequence generated by running Program P1_3 with the parameter a changed to 0.^ ^ is denotes matrix power but .9 and the parameter K changed to 20 is shown below: 6 .10 The purpose of the command subplot is used to separate the figure window to present some figures at the same time.

x). Answers: Q1. arg = 2*pi*f*n . ylabel('Amplitude'). grid. xlabel('Time index n'). 7 .5. f = 0.11 and Q1.15 The length of this sequence is 36 It is controlled by the following MATLAB command line: n = 0:35 It can be changed to generate sequences with different lengths as follows (give an example command line and the corresponding length): n = 0:24 with the length of the sequence is 25 Q1. % Program P1_4 % Generation of a sinusoidal sequence n = 0:40. title('Sinusoidal Sequence'). phase = 0. axis. % Clear old graph stem(n.3 Sinusoidal sequences A copy of Program P1_4 is given below.phase.16 The energies of the real-valued exponential sequences x[n]generated in Q1. x = A*cos(arg).1. % Plot the generated sequence axis([0 40 -2 2]).17 The sinusoidal sequence generated by running Program P1_4 is displayed below.Q1. clf. A = 1.14 and computed using the command sum are – Project 1.

clf. phase = 0. Q1. x = A*cos(arg). Q1. A = 1.22 The modified Program P1_4 to generate a sinusoidal sequence of frequency 0. arg = 2*pi*f*n .phase. The parameter controlling the phase of this sequence is phase The parameter controlling the amplitude of this sequence is A The period of this sequence is 10s Q1.05 can be generated by the following command line: f = 0.19 The length of this sequence is 41 samples It is controlled by the following MATLAB command line: n = 0:40.1 Hz It is controlled by the following MATLAB command line: f = 0. A sequence with new length 20 can be generated by the following command line: n = 0:20.1 A sequence with new frequency 0.Q1.21 The purpose of axis command is used to control axis scaling and appearance The purpose of grid command is used to grid lines.05. % Clear old graph 8 .20 The average power of the generated sinusoidal sequence is Pav= 1 N ∑| x[n] | n =0 N −1 2 Q1.9 is given below along with the sequence generated by running it.5. % Program P1_4 % Generation of a sinusoidal sequence n = 0:40.9. f = 0.18 The frequency of this sequence is 0.

axis. amplitude 2.23 The sinusoidal sequence of length 50. title('Sinusoidal Sequence').x). % Plot the generated sequence axis([0 40 -2 2]). 9 .stem(n.17 shows that they are approximate each other. Q1. xlabel('Time index n'). and phase shift of 90 degrees generated by modifying Program P1_4 is displayed below. ylabel('Amplitude'). A comparison of this new sequence with the one generated in Question Q1.17 shows that two signal are approximated each other because the sampling frequency is very small A sinusoidal sequence of frequency 1.1 generated by modifying Program P1_4 is shown below. frequency 0.5. A comparison of this new sequence with the one generated in Question Q1. grid.08.

5s Q1.17 is the new plot is the linear one. Q1.24 By replacing the stem command in Program P1_4 with the plot command. the plot obtained is as shown below: The difference between the new plot and the one generated in Question Q1.The period of this sequence is 12.25 By replacing the stem command in Program P1_4 with the stairs command the plot obtained is as shown below: 10 .

The difference between the new plot and those generated in Questions Q1.26 The MATLAB program to generate and display a random signal of length 100 with elements uniformly distributed in the interval [–2.title('random signal'). 2] is given below along with the plot of the random sequence generated by running the program: %program to generate and display a random signal of length 100 with elements uniformly distributed in the interval [–2.4 Answers: Q1. Random signals 11 . 2] y=-2+4*rand(1.17 and Q1. Project 1. plot(y).100).24 is that the new stairs is the stairstep plot.

plot(y).x(i./x.:)=a*cos(omega*n+phi). hold on. y=randn(1. n=0:30.27 The MATLAB program to generate and display a Gaussian random signal of length 75 with elements normally distributed with zero mean and a variance of 3 is given below along with the plot of the random sequence generated by running the program: %program to generate and display a Gaussian random signal of length 75 with elements normally distributed with zero mean and a variance of 3 x=3^(1/12). x(i. for i=1:5 a=4*rand. stem (n. 12 . omega=2*pi*0.:)). title('Gaussian random signal') Q1.1. end. Also shown are five sample sequences generated by running this program five different times. phi=2*pi*rand.28 The MATLAB program to generate and display five sample sequences of a random sinusoidal signal of length 31 {X[n]} = {A cos(n + )} o where the amplitude A and the phase are statistically independent random variables with uniform probability distribution in the range 0 ≤ A ≤ 4 for the amplitude and in the range 0 ≤ φ ≤ 2π for the phase is given below.75).Q1.

5 A copy of Program P1_5 is given below.1) .29 The signals generated by running Program P1_5 are displayed below: 13 . % Program P1_5 % Signal Smoothing by Averaging clf.ylabel('Amplitude'). xlabel('Time index n').'b-. R = 51.2 SIMPLE OPERATIONS ON SEQUENCES Signal Smoothing Project 1.x.x2 = [0 x 0].'r-'.5).'g--'). plot(m.9. x1 = [0 0 x].s.d'. % Generate noise corrupted signal subplot(2.8*(rand(R.*(0.'r-'.1. Answers: Q1. d = 0.y(2:R+1). subplot(2.'s[n] ').1.ylabel('Amplitude'). xlabel('Time index n').s.2).x3 = [x 0 0]. y = (x1 + x2 + x3)/3.'x[n] ').m.'). legend('d[n] '.'s[n] '.m. s = 2*m.1.1). % Generate uncorrupted signal x = s + d'.m. legend( 'y[n] '. % Generate random noise m = 0:R-1.'g--'.0. plot(m.^m).

xH = sin(2*pi*fH*n).6 Generation of Complex Signals A copy of Program P1_6 is given below.1.1) .32 The relations between the signals x1. xlabel('Time index n'). and x3. Answers: Q1. n = 0:100. The additive noise d[n]is d = 0.33 The purpose of the legend command is allow display legend Project 1. xL = sin(2*pi*fL*n).fH = 0.9.y). Q1. and various values of the modulation index m are shown below: 14 .ylabel('Amplitude'). x2.30 The uncorrupted signal s[n]is s = 2*m.4.0. % Program P1_6 % Generation of amplitude modulated sequence clf. and the signal x are the shifted version of x Q1.Q1.34 The amplitude modulated signals y[n] generated by running Program P1_6 for various values of the frequencies of the carrier signal xH[n] and the modulating signal xL[n]. y = (1+m*xL).8*(rand(R.*(0.5).01. stem(n. m = 0.*xH.^m).grid. fL = 0.31 The statement x = s + d CANNOT be used to generate the noise corrupted signal because don’t add a vector row with a vector column Q1.

100.35 The difference between the arithmetic operators * and . arg = a*n. axis. stem(n.1. grid. clf. 15 . a = pi/2/100.Q1.-1. % Program P1_7 % Generation of a swept frequency sinusoidal sequence n = 0:100.36 The swept-frequency sinusoidal sequence x[n] generated by running Program P1_7 is displayed below. b = 0. title('Swept-Frequency Sinusoidal Signal'). x = cos(arg). xlabel('Time index n').5.*n + b*n. axis([0. x).* denotes array multiply A copy of Program P1_7 is given below.* * denotes matrix multiply and . Answers: Q1. ylabel('Amplitude').5]).

x).2 are given below along with the sequences generated by running these programs: %to generate a sawtooth signal with frequency of 50Hz and sampling frequency of 10000Hz fs = 10000.1 and 1. Q1.3 is given below: 1. axis([0 0.37 The minimum and maximum frequencies of this signal are Q1.2 -1 1]) 16 .3 WORKSPACE INFORMATION Q1.Q1.1 and a maximum frequency of 0.38 The Program 1_7 modified to generate a swept sinusoidal signal with a minimum frequency of 0.8 Answer: Q1.4 OTHER TYPES OF SIGNALS (Optional) Squarewave and Sawtooth Signals Project 1.40 The information displayed in the command window as a result of the whos command is the list current variables in long form.5. 1.39 The information displayed in the command window as a result of the who command is the list current variables.41 MATLAB programs to generate the square-wave and the 0 wave sequences of the type shown in Figures 1. plot(t. t = 0:1/fs:1. x = sawtooth(2*pi*50*t).

x = square(2*pi*50*t. plot(t.axis([0 0.2 -2 2]). Date: Signature: 17 . t = 0:1/fs:1.5. title('square signal').20).x).%to generate a square signal with frequency of 50Hz and duty circle of 20 percent of the period fs = 10000.

- NI Tutorial 11503 en
- crf_intro
- SMARANDACHE SEMI-AUTOMATON AND AUTOMATON
- Economic dynamic
- Miller Puckette - The Theory and Technique of ElectronicMusic
- 1 Vibration - Starter1
- 06BIST0603
- HRS a New Look at Seismic Attributes
- Assign 7
- Changes in H Reflex and v Wave Following Short-term Endurance and Strength Training
- Conv Codes
- Equation
- art-3A10.1007-2Fs13320-012-0076-1
- 140F11H3
- Additional Material Harris Detector
- CSm51a Lecture 11
- 125760133 Buckling of Thin Metal Shells 88
- Bar math
- Cate Nary
- Inductor Selection
- Math 320 December 2007
- Notes on Quadratic Functions
- Graphs
- 4-oscillations.pdf
- Assignment 2 Analog and Digital Comm.
- Signal and System
- Proe Mechanism Les21
- Stream Keys by Irrational Numbers
- CemKamon_Phitchaphat2003
- Thesis Quantum Wire 12312

Are you sure?

This action might not be possible to undo. Are you sure you want to continue?

We've moved you to where you read on your other device.

Get the full title to continue

Get the full title to continue reading from where you left off, or restart the preview.

scribd