LABEX1 - Resuelta
LABEX1 - Resuelta
LABORATORIO I
Procesamiento Digital de seales
Nombre: Antonio R. Ledezma Arandia Docente: ing. Zurita Villarroel Grover Fecha: 23-08-2013
Name:
Laboratory Exercise 1
DISCRETE-TIME SIGNALS: TIME-DOMAIN REPRESENTATION
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
Q1.2
clf command is Limpia la ventana de la figura axis command is Asigna los margenes de x, y en la grafica Coloca titulo General a nuestra grafica Coloca un titulo a nuestro eje x - Coloca un titulo a nuestro eje y
Q1.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 clf; % Generate a vector from -10 to 20 n = -10:20; % Generate the unit sample sequence u = [zeros(1,10) zeros(1,11) 1 zeros(1,20-11)]; % Plot the unit sample sequence stem(n,u); xlabel('Time index n');ylabel('Amplitude'); title('Unit Sample Sequence'); axis([-10 20 0 1.2]);
Q1.4
The modified Program P1_1 to generate a unit step sequence sequence generated by running this program . % 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) zeros(1,11) 1 ones(1,20-11)]; % Plot the unit sample sequence stem(n,u); xlabel('Time index n');ylabel('Amplitude'); title('Unit Sample Sequence'); axis([-10 20 0 1.2]);
Q1.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 .
% 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-7) 1 ones(1,20+7)]; % Plot the unit sample sequence stem(n,u); xlabel('Time index n');ylabel('Amplitude'); title('Unit Sample Sequence'); axis([-10 20 0 1.2]);
Project 1.2
Exponential signals
A copy of Programs P1_2 and P1_3 are given below . % Program P1_2 % Generation of a complex exponential sequence clf; c = -(1/12)+(pi/6)*i; K = 2; n = 0:40; x = K*exp(c*n); subplot(2,1,1);
stem(n,real(x)); xlabel('Time index n');ylabel('Amplitude'); title('Real part'); subplot(2,1,2); stem(n,imag(x)); xlabel('Time index n');ylabel('Amplitude'); title('Imaginary part');
Answers: Q1.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 - El parametro C es el que controla si: C = 1 las partes real e imaginaria son senoidales, C < corresponden a secuencias senoidales multiplicadas por un exponencial decreciente y C>1 corresponden a secuencias senoidales multiplicadas por un exponencial creciente The parameter controlling the amplitude of this sequence is
la variable k
Q1.8
empieza a crecer
Q1.9 The purpose of the operator The purpose of the operator Q1.10
realis mostrar solo la parte real de la ecuacin imag is mostrar solo la parte imaginaria de la ecuacin
The purpose of the command subplotis Generar una mayor cantidad de grficos en una ventana grafica de matlab
Q1.11
The real-valued exponential sequence generated by running Program P1_3 is shown below :
Q1.12
The parameter controlling the rate of growth or decay of this sequence is - Si a y k son reales podemos decir que: a>1 la magnitude de la seal crece exponencialmente, a<1 tenemos una exponencial decreciente The parameter controlling the amplitude of this sequence is
la constante k
Q1.13
.^ is la diferencia est en que cuando se usa el punto, no debe sere scalar necesariamente, a diferencia de quitar el punto los valores deben ser escalares.
Q1.14
The sequence generated by running Program P1_3 with the parameter parameter K changed to 20 is shown below :
Q1.15
modific la constante K
It is controlled by the following MATLAB command line : a = 0.9; K = 20; x = K*a.^n; It can be changed to generate sequences with different lengths as follows (give an example command line and the corresponding length) : 0:35; a = 1.2; K = 0.20; K*a.^n; El anterior cdigo corresponde a una parte de programa P1_3 en donde si queremos variar la longitud de la seal solo cambiamos la variable n : 0:60; a = 1.2; K = 0.20; K*a.^n; Si graficamos esta funcin la longitud de la seal cambio a una longitud de 60, lo mismo pasa con la amplitud
n = x = n = x = K.
Q1.16
clf; n = 0:35; a = 1.2; K = 0.2; x = K*a.^n; b = 0.9; C = 20; y = C*b.^n; T = sum(x.^2 + y.^2) >> ej_sum T = 4.7777e+04
The energies of the real-valued exponential sequences Q1.14 and computed using the command sum are
Project 1.3
Sinusoidal sequences
A copy of Program P1_4 is given below . % Program P1_4 % Generation of a sinusoidal sequence n = 0:40; f = 0.1; phase = 0; A = 1.5; arg = 2*pi*f*n - phase; x = A*cos(arg); clf; % Clear old graph stem(n,x); % Plot the generated sequence axis([0 40 -2 2]); grid; title('Sinusoidal Sequence'); xlabel('Time index n'); ylabel('Amplitude'); axis;
Answers: Q1.17 The sinusoidal sequence generated by running Program P1_4 is displayed below .
Q1.18 phase;
The frequency of this sequence is- 10 Hz It is controlled by the following MATLAB command line : f = 0.1; arg = 2*pi*f*n -
A sequence with new frequency _____ can be generated by the following command line : f
rand(1,1); 8
phase;
The parameter controlling the phase of this sequence is - phase = 0; arg = 2*pi*f*n The parameter controlling the amplitude of this sequence is- A = 1.5;
It is controlled by the following MATLAB command line : A = 1.5; A sequence with new length _____ can be generated by the following command line : A = rand(1,1); The average power of the generated sinusoidal sequence is - arg = 2*pi*f*n The purpose of
axis command is - Configurar el la ventana donde se ve el grafico en MaTlab, los valores corresponden a: Xmin, Xmax, Ymin, Ymax
The purpose of
ventana de matlab
Q1.22 The modified Program P1_4 to generate a sinusoidal sequence of frequency 0.9 is given below along with the sequence generated by running it .
% Program P1_4 % Generation of a sinusoidal sequence n = 0:40; f = 0.9; Frecuencia=1/f phase = 0; A = 1.5; arg = 2*pi*f*n - phase; x = A*cos(arg); clf; % Clear old graph stem(n,x); % Plot the generated sequence axis([0 40 -2 2]); grid; title('Sinusoidal Sequence'); xlabel('Time index n'); ylabel('Amplitude'); axis;
A comparison of this new sequence with the one generated in Question Q1.17 shows
- Es
10
A comparison of this new sequence with the one generated in Question Q1.17 shows
By replacing the stem command in Program P1_4 with the is as shown below:
11
The difference between the new plot and the one generated in Question Q1.17 is
- El
The difference between the new plot and those generated in Questions Q1.17 and Q1.24 is- El comando stairs muestra la seal como si fuse una seal digital.
12
Random signals
The MATLAB program to generate and display a random signal of length 100 with elements uniformly distributed in the interval [2, 2] is given below along with the plot of the random sequence generated by running the program :
Q1.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 :
13
Q1.28
The MATLAB program to generate and display five sample sequences of a random si nusoidal signal of length 31
{X[n]} = {A*cos(on + )}
where the amplitudeA 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. Also shown are five sample sequences generated by running this program five different times . clf; f1 = 0.50; f2 = 0.60; f3 = 0.70; f4 = 0.050; f5 = 0.080; n = 0:31; A = 4*rand(1,1); r1 = 2*pi*rand(1,1); T1 = A*cos(2*pi*f1*n+r1); plot(n,T1,'R') hold on; T1 = A*cos(2*pi*f2*n+r1); plot(n,T1,'Y') hold on; T1=A*cos(2*pi*f3*n+r1); plot(n,T1,'K') hold on; T1=A*cos(2*pi*f4*n+r1); plot(n,T1,'B') hold on; T1=A*cos(2*pi*f5*n+r1); plot(n,T1,'G') legend( 'S1[R] ','S2[Y] ','S3[K] ','S4[B] ','S5[G] '); hold off;
14
1.2
Project 1.5
A copy of Program P1_5 is given below . % Program P1_5 % Signal Smoothing by Averaging clf; R = 51; d = 0.8*(rand(R,1) - 0.5); % Generate random noise m = 0:R-1; s = 2*m.*(0.9.^m); % Generate uncorrupted signal x = s + d'; % Generate noise corrupted signal subplot(2,1,1); plot(m,d','r-',m,s,'g--',m,x,'b-.'); xlabel('Time index n');ylabel('Amplitude'); legend('d[n] ','s[n] ','x[n] '); x1 = [0 0 x];x2 = [0 x 0];x3 = [x 0 0]; y = (x1 + x2 + x3)/3; subplot(2,1,2); plot(m,y(2:R+1),'r-',m,s,'g--'); legend( 'y[n] ','s[n] '); xlabel('Time index n');ylabel('Amplitude');
Answers: Q1.29 The signals generated by running Program P1_5 are displayed below :
15
Q1.30
Q1.31
x = s + d CAN / CANNOT be used to generate the noise corrupted - No se puede usar por que nos sale con cierta distorsion(Ruido)
Q1.32
The relations between the signalsx1, x2, andx3, and the signal xare - Son los vectores(X1, X2, X3) son los que muestrean la seal (3 vectores, se puede decir que son un tipo de filtro) y X es la seal resultante el promedio The purpose of thelegendcommand is distintas seales por color y tipo de lnea. Generation of Complex Signals
Q1.33
Project 1.6
A copy of Program P1_6 is given below . % Program P1_6 % Generation of amplitude modulated sequence clf; n = 0:100; m = 0.4;fH = 0.1; fL = 0.01; xH = sin(2*pi*fH*n); xL = sin(2*pi*fL*n); y = (1+m*xL).*xH; stem(n,y);grid; xlabel('Time index n');ylabel('Amplitude');
Answers:
16
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], and various values of the modulation index m are shown below :
Q1.35
* and .* is la diferencia esta en que si solo se utilizer el asterisco solo se podran multiplicar numeros escalares, en cambio si utilizamos un punto, se podra utilizar vectores.
A copy of Program P1_7 is given below . % Program P1_7 % Generation of a swept frequency sinusoidal sequence n = 0:100; a = pi/2/100; b = 0; arg = a*n.*n + b*n; x = cos(arg); clf; stem(n, x); axis([0,100,-1.5,1.5]); title('Swept-Frequency Sinusoidal Signal'); xlabel('Time index n'); ylabel('Amplitude'); grid; axis; Answers: Q1.36 The swept-frequency sinusoidal sequence displayed below.
17
Q1.37 Q1.38
ayb
The Program 1_7 modified to generate a swept sinusoidal signal with a minimum frequency of 0.1 and a maximum frequency of 0.3 is given below :
% Program P1_7 % Generation of a swept frequency sinusoidal sequence n = 3:10; a = pi/2/100; b = 0; arg = a*n.*n + b*n; x = cos(arg); clf; stem(n, x); axis([3,10,-1.5,1.5]); title('Swept-Frequency Sinusoidal Signal'); xlabel('Time index n'); ylabel('Amplitude'); grid; axis;
18
1.3 Q1.39
WORKSPACE INFORMATION The information displayed in the command window as a result of the
x whos command
The information displayed in the command window as a result of the is Muestra la informacion de cada variable.
Bytes Class 8 double 32 double 808 double 8 double 808 double 808 double
Attributes
19
1.4
MATLAB programs to generate the square-wave and the sawtooth wave sequences of the type shown in Figures 1.1 and 1.2 are given below along with the sequences generated by running these programs :
n = 0:100; x = square(n); stem(n, x); axis([0,100,-1.5,1.5]); title('Swept-Frequency Sinusoidal Signal'); xlabel('Time index n'); ylabel('Amplitude'); grid; axis;
n = 0:100; x = sawtooth(n); stem(n, x); axis([0,100,-1.5,1.5]); title('Swept-Frequency Sinusoidal Signal'); xlabel('Time index n'); ylabel('Amplitude'); grid; axis;
20
Date: 26/08/2013
Signature: DSP
21