Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Autores:
Fernando Campos Campos, fercap @live.com.mx
25 de Marzo de 2021
Índice general
A. Codigos de Matlab 16
Problema 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Problema 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Problema 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Problema 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Problema 7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Problema 10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
1
Capı́tulo 1
Problema 1
Utilizando el enfoque de multiplicación matriz-vector, escriba una función de MATLAB
para calcular la DTFT de una secuencia de duración finita. El formato de la función deberá
ser:
Utilice esta función para calcular la DTFT X(ejω ) de las siguientes secuencias de
duración finita sobre −π ≤ ω ≤ ω. Grafique la magnitud y la fase en una figura.
1. x(n) = (0,6)|n| [u(n + 10) − u(n − 11)]. Comente sobre la gráfica del angulo.
5. x(n) = {4, 3, 2, 1, −1, −2, −3, −4}. Comente sobre la grafica del angulo.
Respuestas
1. x(n) = (0,6)|n| [u(n + 10) − u(n − 11)].
2
Figura 1.1: Grafica de problema 1.1.
3
Figura 1.3: Grafica de problema 1.3.
4
5. x(n) = {4, 3, 2, 1, −1, −2, −3, −4}.
Problema 2
Sea x1 (n) = {1, 2, 2, 1}. Una nueva secuencia x2 (n) es formada utilizando:
x1 (n) 0≤n≤3
x2 (n) = x1 (n − 4) 4≤n≤7 (1.1)
0 Otro caso.
Respuestas
1. x2 (n) = x1 (n) + x1 (n − 4). Por lo tanto:
X2 (ejω ) = X1 (ejω ) + X1 (ejω )e−j4ω = 2e−j2ω cos(2ω)X1 (ejω ) (1.2)
5
2. Calculando y graficando las magnitudes de las respectivas DTFTs.
Probrema 3
Determine analı́ticamente la DTFT de cada una de las siguientes secuencias. Grafique
la magnitud y el angulo de X(ejω ) sobre 0 ≤ ω ≤ π
1. x(n) = 2(0,5)n u(n + 2).
2. x(n) = (0,6)|n| [u(n + 10) − u(n − 11)].
3. x(n) = n(0,9)n u(n + 3).
4. x(n) = (n + 3)(0,8)n−1 u(n − 2).
5. x(n) = 4(−0,7)n cos(0,25πn)u(n).
6
Respuestas
1. x(n) = 2(0,5)n u(n + 2).
7
Figura 1.9: Grafica de problema 3.3.
8
5. x(n) = 4(−0,7)n cos(0,25πn)u(n).
Problema 4
Las siguientes secuencias de duración finita son conocidas como ventanas y son muy
útiles en DSP:
1 0≤n≤M
Rectangular RM (n) = (1.3)
0 Otro caso.
2πn
Hanning CM (n) = 0,5[1 − cos ]RM (n) (1.4)
M −1
|M − 1 − 2n|
Triangular TM (n) = [1 − ]RM (n) (1.5)
M −1
2πn
Hamming HM (n) = [0,54 − 0,46 cos ]RM (n) (1.6)
M −1
Para cada una de estas ventanas, determine sus DTFTs para M = 10, 25, 50, 101. Escale
los valores de la transformada tal que el valor máximo sea igual a 1. Grafique la magnitud
de la DTFT normalizada sobre π ≤ ω ≤ π. Estudie estas gráficas y comente sobre su
comportamiento como una función de M .
9
Respuestas
Problema 6
Utilizando la definición de la DTFT inversa en la Ecuación (2) de la unidad, determine
las secuencias correspondientes a las siguientes DTFTs.
1.
jw 1 0 ≤ |ω| ≤ π/3
x(e ) = (1.7)
0 π/3 ≤ |ω| ≤ π
2.
jω 0 0 ≤ |ω| ≤ 3π/4
X(e ) = (1.8)
1 3π/4 ≤ |ω| ≤ π
3.
2 0 ≤ |ω| ≤ π/8
jω
X(e ) = 1 π/8 ≤ |ω| ≤ 3π/4 (1.9)
0 3π/4 ≤ |ω| ≤ π
4.
0 −π ≤ |ω| ≤ π/4
jω
X(e ) = 1 π/4 ≤ |ω| ≤ 3π/4 (1.10)
0 3π/4 ≤ |ω| ≤ π
5.
X(ejω ) = ωej(π/2−10ω) (1.11)
10
Recuerde que las transformadas anteriores son periódicas en ω con periodo igual a 2π .
Por consiguiente las funciones están dadas solo sobre el periodo primario de −π ≤ ω ≤ π.
Respuestas
1. π
ejnω π/3
Z
1 sin(πn/3) sin n/3
x(n) = x(ejω )ejnω dω = |−π/3 = = (1.12)
2π −π j2nπ πn 3
2.
−3π/4
ejnω −π
Z
1 3sinc3n/4
x(n) = x(ejω )ejnω dω = |−3π/4 = − (1.13)
2π −π j2nπ 4
3.
1 n 3 3n
x(n) = sinc( ) + sinc (1.14)
8 8 4 4
4.
3 3n 1 n
x(n) = sinc( ) − sinc( ) (1.15)
4 4 4 4
5.
sin[(n − 10)π]
x(n) = cos[(n − 10)π] − (1.16)
π(n − 10)2
Problema 7
Una secuencia de valores complejos x(n) puede ser descompuesta en una parte simétri-
ca conjugada xe (n) y una parte antisimetrica conjugada xo (n). Demuestre que
donde XR (ejω ) y jX1 (ejω ) son las partes real e imaginaria de la DTFT xe (n) ), respecti-
vamente. Verifique esta propiedad en
11
Respuestas
Problema 10
12
Respuestas
1. .
2. .
13
Figura 1.15: Grafica de problema 10.2
14
3. .
15
Apéndice A
Codigos de Matlab
Problema 1
% %Problema 1
clc ; close all ;
% %Primera s e c u e n c i a
%Parametros i n i c i a l e s
[ x11 , n11 ]= s t e p s e q ( −10 , −11 ,11);
[ x12 , n12 ]= s t e p s e q ( 1 1 , − 1 1 , 1 1 ) ;
[ x13 , n13 ]= s i g a d d ( x11 , n11 ,−x12 , n12 ) ;
n1=n13 ;
x1 = ( 0 . 6 . ˆ abs ( n1 ) ) . * x13 ;
w1=l i n s p a c e (−pi , pi , 2 0 1 ) ;
X1=d t f t ( x1 , n1 , w1 ) ;
magX1=abs (X1 ) ; phaX1 = a n g l e (X1 ) ;
% Graficas 1
h f i g 1=f i g u r e ;
subplot (2 ,1 ,1);
p l o t (w1/ pi , magX1 ) ;
a x i s ([ −1 1 0 4 . 5 ] ) ;
wtick = [ − 1 : 0 . 2 : 1 ] ;
magtick = [ 0 : 0 . 5 : 4 . 5 ] ;
x l a b e l ( ’ \omega/\ p i ’ ) ;
y l a b e l ( ’ |X| ’ ) ;
t i t l e ( ’ Respuesta de magnitud ’ ) ;
% Grafica 2
subplot (2 ,1 ,2);
p l o t (w1/ pi , phaX1 * 180/ p i ) ;
axis ([ −1 ,1 , −180 ,180]);
p h a t i c k = [ −180 0 1 8 0 ] ;
x l a b e l ( ’ \omega/\ p i ’ ) ;
y l a b e l ( ’ Grados ’ ) ;
t i t l e ( ’ Respuesta de l a f a s e ’ ) ;
p r i n t ( h f i g 1 , ’−dpng ’ , ’ /home/ s t o r m i e s t n u t /Documents/ S o f t w a r e s c r i p t / . . .
S o f t w a r e / Matlab /PDSC/ Problema 3 / problema 01 / f i g u r a 1 . png ’ ) ;
% %Segunda s e c u e n c i a
%Parametros i n i c i a l e s
[ x21 , n21 ]= s t e p s e q ( 0 , 0 , 2 2 ) ;
16
[ x22 , n22 ]= s t e p s e q ( 2 1 , 0 , 2 2 ) ;
[ x23 , n23 ]= s i g a d d ( x21 , n21 ,−x22 , n22 ) ;
n2=n23 ;
x2=n2 . * ( 0 . 9 . ˆ n2 ) . * x23 ;
w2=l i n s p a c e (−pi , pi , 2 0 1 ) ;
X2=d t f t ( x2 , n2 , w2 ) ;
magX2=abs (X2 ) ;
phaX2=a n g l e (X2 ) ;
%G r a f i c a 1
h f i g 2=f i g u r e ;
subplot (2 ,1 ,1);
p l o t (w2/ pi , magX2 ) ;
wtick = [ − 1 : 0 . 2 : 1 ] ;
magtick = [ 0 : 1 0 : 6 0 ] ;
x l a b e l ( ’ \omega/\ p i ’ ) ;
y l a b e l ( ’ |X| ’ ) ;
t i t l e ( ’ Respuesta de magnitud ’ ) ;
%G r a f i c a 2
subplot (2 ,1 ,2);
p l o t (w2/ pi , phaX2 * 180/ p i ) ;
axis ([ −1 ,1 , −200 ,200]);
phatick =[ −180:60:180];
x l a b e l ( ’ \omega/\ p i ’ ) ;
y l a b e l ( ’ Grados ’ ) ;
t i t l e ( ’ Respuesta de l a f a s e ’ ) ;
p r i n t ( h f i g 2 , ’−dpng ’ , ’ /home/ s t o r m i e s t n u t /Documents/ S o f t w a r e s c r i p t / . . .
S o f t w a r e / Matlab /PDSC/ Problema 3 / problema 01 / f i g u r a 2 . png ’ ) ;
% %T e r c e r a s e c u e n c i a
%Parametros i n i c i a l e s
[ x31 , n31 ]= s t e p s e q ( 0 , 0 , 5 2 ) ;
[ x32 , n32 ]= s t e p s e q ( 5 1 , 0 , 5 2 ) ;
[ x33 , n33 ]= s i g a d d ( x31 , n31 ,−x32 , n32 ) ;
n3=n33 ;
x3=( c o s ( 0 . 5 * p i * n3)+ j * s i n ( 0 . 5 * p i * n3 ) ) . * x33 ;
w3=l i n s p a c e (−pi , pi , 2 0 1 ) ; X3 = d t f t ( x3 , n3 , w3 ) ;
magX3=abs (X3 ) ;
phaX3 = a n g l e (X3 ) ;
%G r a f i c a 1
h f i g 3=f i g u r e ;
subplot (2 ,1 ,1);
p l o t (w3/ pi , magX3 ) ;
wtick = [ − 1 : 0 . 2 : 1 ] ;
magtick = [ 0 : 1 0 : 6 0 ] ;
x l a b e l ( ’ \omega/\ p i ’ ) ;
y l a b e l ( ’ |X| ’ ) ;
t i t l e ( ’ Respuesta de magnitud ’ ) ;
%G r a f i c a 2
subplot (2 ,1 ,2);
p l o t (w3/ pi , phaX3 * 180/ p i ) ;
axis ([ −1 ,1 , −200 ,200]);
17
phatick =[ −180:60:180];
x l a b e l ( ’ \omega/\ p i ’ ) ;
y l a b e l ( ’ Grados ’ ) ;
t i t l e ( ’ Respuesta de f a s e ’ ) ;
p r i n t ( h f i g 3 , ’−dpng ’ , ’ /home/ s t o r m i e s t n u t /Documents/ S o f t w a r e s c r i p t / . . .
S o f t w a r e / Matlab /PDSC/ Problema 3 / problema 01 / f i g u r a 3 . png ’ ) ;
% %Cuarta s e c u e n c i a
%Parametros i n i c i a l e s
x4 =[4 3 2 1 1 2 3 4 ] ;
n4 = [ 0 : 7 ] ;
w4=l i n s p a c e (−pi , pi , 2 0 1 ) ;
X4=d t f t ( x4 , n4 , w4 ) ;
magX4=abs (X4 ) ; phaX4 = a n g l e (X4 ) ;
%G r a f i c a 1
h f i g 4= f i g u r e ;
subplot (2 ,1 ,1);
p l o t (w4/ pi , magX4 ) ;
axis ([ −1 ,1 ,0 ,25]);
wtick = [ − 1 : 0 . 2 : 1 ] ;
magtick = [ 0 : 5 : 2 5 ] ;
x l a b e l ( ’ \omega/\ p i ’ ) ;
y l a b e l ( ’ |X| ’ ) ;
t i t l e ( ’ Respuesta de magnitud ’ ) ;
%G r a f i c a 2
subplot (2 ,1 ,2);
p l o t (w4/ pi , phaX4 * 180/ p i ) ;
axis ([ −1 ,1 , −200 ,200]);
phatick =[ −180:60:180];
x l a b e l ( ’ \omega/\ p i ’ ) ;
y l a b e l ( ’ Grados ’ ) ;
t i t l e ( ’ Respuesta de f a s e ’ ) ;
p r i n t ( h f i g 4 , ’−dpng ’ , ’ /home/ s t o r m i e s t n u t /Documents/ S o f t w a r e s c r i p t / . . .
S o f t w a r e / Matlab /PDSC/ Problema 3 / problema 01 / f i g u r a 4 . png ’ ) ;
% %Quinta s e c u e n c i a
%Parametros i n i c i a l e s
x5 =[4 3 2 1 −1 −2 −3 −4];
n5 = [ 0 : 7 ] ;
w5=l i n s p a c e (−pi , pi , 2 0 1 ) ;
X5=d t f t ( x5 , n5 , w5 ) ;
magX5=abs (X5 ) ;
phaX5=a n g l e (X5 ) ;
%G r a f i c a 1
h f i g 5=f i g u r e ;
subplot (2 ,1 ,1);
p l o t (w5/ pi , magX5 ) ;
wtick = [ − 1 : 0 . 2 : 1 ] ;
magtick = [ 0 : 5 : 2 0 ] ;
a x i s ([ −1 1 0 2 0 ] ) ;
x l a b e l ( ’ \omega/\ p i ’ ) ;
y l a b e l ( ’ |X| ’ ) ;
18
t i t l e ( ’ Respuesta de magnitud ’ ) ;
%G r a f i c a 2
subplot (2 ,1 ,2);
p l o t (w5/ pi , phaX5 * 180/ p i ) ;
axis ([ −1 ,1 , −200 ,200]);
phatick =[ −180:60:180];
x l a b e l ( ’ \omega/\ p i ’ ) ;
y l a b e l ( ’ Grados ’ ) ;
t i t l e ( ’ Respuesta de f a s e ’ ) ;
p r i n t ( h f i g 5 , ’−dpng ’ , ’ /home/ s t o r m i e s t n u t /Documents/ S o f t w a r e s c r i p t / . . .
S o f t w a r e / Matlab /PDSC/ Problema 3 / problema 01 / f i g u r a 5 . png ’ ) ;
Problema 2
% %Problema 2
clc ; close all ;
%Parametros i n i c i a l e s
n1 = [ 0 : 3 ] ;
x1 =[1 2 2 1 ] ;
n2 = [ 0 : 7 ] ;
x2 =[ x1 x1 ] ;
w2=l i n s p a c e (−pi , pi , 2 0 1 ) ;
X1=d t f t ( x1 , n1 , w2 ) ;
X2=d t f t ( x2 , n2 , w2 ) ;
magX1=abs (X1 ) ;
phaX1=a n g l e (X1 ) ;
magX2=abs (X2 ) ;
phaX2=a n g l e (X2 ) ;
wtick = [ − 1 : 0 . 5 : 1 ] ;
p h a t i c k =[ −180:60 : 1 8 0 ] ;
%G r a f i c a 1
h f i g 1=f i g u r e ;
subplot (2 ,2 ,1);
p l o t (w2/ pi , magX1 ) ;
a x i s ([ −1 1 0 8 ] ) ;
magtick1 = [ 0 : 2 : 8 ] ;
x l a b e l ( ’ \omega/\ p i ’ ) ;
ylabel ( ’ | X 1 | ’ );
t i t l e ( ’ Respuesta de magnitud ’ ) ;
%G r a f i c a 2
subplot (2 ,2 ,3);
p l o t (w2/ pi , phaX1 * 180/ p i ) ;
a x i s ([ −1 1 −200 2 0 0 ] ) ;
x l a b e l ( ’ \omega/\ p i ’ ) ;
y l a b e l ( ’ Grados ’ ) ;
// t i t l e ( ’ R e s p u e s t a de f a s e ’ ) ;
subplot (2 ,2 ,2);
p l o t (w2/ pi , magX2 ) ;
a x i s ([ −1 1 0 1 6 ] ) ;
magtick2 = [ 0 : 4 : 1 6 ] ;
19
x l a b e l ( ’ \omega/\ p i ’ ) ;
ylabel ( ’ | X 2 | ’ );
t i t l e ( ’ Respuesta de magnitud ’ ) ;
%G r a f i c a 4
subplot (2 ,2 ,4);
p l o t (w2/ pi , phaX2 * 180/ p i ) ;
a x i s ([ −1 1 −200 2 0 0 ] ) ;
x l a b e l ( ’ \omega/\ p i ’ ) ;
y l a b e l ( ’ Grados ’ ) ;
%t i t l e ( ’ Respuesta de f a s e ’ ) ;
p r i n t ( h f i g 1 , ’−dpng ’ , ’ /home/ s t o r m i e s t n u t /Documents/ S o f t w a r e s c r i p t . . .
/ S o f t w a r e / Matlab /PDSC/ Problema 3 / problema 02 / f i g u r a 1 . png ’ ) ;
Problema 3
% %Problema 2
clc ; close all ;
% %Primer f u n c i o n
%Parametros i n i c i a l e s
w1=l i n s p a c e ( 0 , pi , 5 0 1 ) ;
X1=8* exp ( 1 i * 2 * w1 ) . / ( 1 − 0 . 5 * exp(−1 i * w1 ) ) ;
magX1 = abs (X1 ) ; phaX1 = a n g l e (X1 ) ;
%G r a f i c a 1
h f i g 1=f i g u r e ;
subplot (2 ,1 ,1);
p l o t (w1/ pi , magX1 ) ;
wtick = [ 0 : 0 . 2 : 1 ] ;
magtick = [ 0 : 4 : 2 0 ] ;
axis ([0 ,1 ,0 ,20]);
x l a b e l ( ’ \omega/\ p i ’ ) ;
y l a b e l ( ’ |X| ’ ) ;
t i t l e ( ’ Respuesta de magnitud ’ ) ;
%G r a f i c a 2
subplot (2 ,1 ,2);
p l o t (w1/ pi , phaX1 * 180/ p i ) ;
axis ([0 ,1 , −200 ,200]);
phatick =[ −180:60:180];
x l a b e l ( ’ \omega/\ p i ’ ) ;
y l a b e l ( ’ Grados ’ ) ;
t i t l e ( ’ Respuesta de f a s e ’ ) ;
p r i n t ( h f i g 1 , ’−dpng ’ , ’ /home/ s t o r m i e s t n u t /Documents/ S o f t w a r e s c r i p t / . . .
S o f t w a r e / Matlab /PDSC/ Problema 3 / problema 03 / f i g u r a 1 . png ’ ) ;
% %Segunda f u n c i o n
%Parametros de e n t r a d a
w2=l i n s p a c e ( 0 , pi , 5 0 1 ) ;
X2=(0.64 −2 * (0.6)ˆ11 * c o s (11 * w2 ) + 2 * ( 0 . 6 ) ˆ 1 2 * c o s (10 * w2 ) ) . / . . .
( 1 . 3 6 − 1 . 2 * c o s (w2 ) ) ;
magX2 = abs (X2 ) ;
phaX2 = a n g l e (X2 ) ;
%G r a f i c a 1
20
h f i g 2=f i g u r e ;
subplot (2 ,1 ,1);
p l o t (w2/ pi , magX2 ) ;
axis ([0 ,1 ,0 ,5]);
wtick = [ 0 : 0 . 2 : 1 ] ;
magtick = [ 0 : 1 : 5 ] ;
x l a b e l ( ’ \omega/\ p i ’ ) ;
y l a b e l ( ’ |X| ’ ) ;
t i t l e ( ’ Respuesta de magnitud ’ ) ;
%G r a f i c a 2
subplot (2 ,1 ,2);
p l o t (w2/ pi , phaX2 * 180/ p i ) ;
axis ([0 ,1 , −200 ,200]);
phatick =[ −180:60:180];
x l a b e l ( ’ \omega/\ p i ’ ) ;
y l a b e l ( ’ Grados ’ ) ;
t i t l e ( ’ Respuesta de f a s e ’ ) ;
p r i n t ( h f i g 2 , ’−dpng ’ , ’ /home/ s t o r m i e s t n u t /Documents/ S o f t w a r e s c r i p t / . . .
S o f t w a r e / Matlab /PDSC/ Problema 3 / problema 03 / f i g u r a 2 . png ’ ) ;
% %T e r c e r a f u n c i o n
%Parametros i n i c i a l e s
w3=l i n s p a c e ( 0 , pi , 5 0 1 ) ;
X3 num=( −4.1151 * exp ( 1 i * 3 * w3)+4.9383 * exp ( 1 i * 2 * w3 ) ) ;
X3 den=1−1.8 * exp(−1 i * w3)+0.81 * exp(−1 i * 2 * w3 ) ;
X3=X3 num . / X3 den ;
magX3=abs (X3 ) ;
phaX3=a n g l e (X3 ) ;
%G r a f i c a 1
h f i g 3=f i g u r e ;
subplot (2 ,1 ,1);
p l o t (w3/ pi , magX3 ) ;
axis ([0 ,1 ,0 ,100]);
wtick = [ 0 : 0 . 2 : 1 ] ;
magtick = [ 0 : 2 0 : 1 0 0 ] ;
x l a b e l ( ’ \omega/\ p i ’ ) ;
y l a b e l ( ’ |X| ’ ) ;
t i t l e ( ’ Respuesta de magnitud ’ ) ;
%G r a f i c a 2
subplot (2 ,1 ,2);
p l o t (w3/ pi , phaX3 * 180/ p i ) ;
axis ([0 ,1 , −200 ,200]);
phatick =[ −180:60:180];
x l a b e l ( ’ \omega/\ p i ’ ) ;
y l a b e l ( ’ Grados ’ ) ;
t i t l e ( ’ Respuesta de f a s e ’ ) ;
p r i n t ( h f i g 3 , ’−dpng ’ , ’ /home/ s t o r m i e s t n u t /Documents/ S o f t w a r e s c r i p t / . . .
S o f t w a r e / Matlab /PDSC/ Problema 3 / problema 03 / f i g u r a 3 . png ’ ) ;
% %Cuarta f u n c i o n
%Parametros i n i c i a l e s
w4=l i n s p a c e ( 0 , pi , 5 0 1 ) ;
21
X4 num=4* exp (−2 * 1 i * w4) −2.56 * exp (−3 * 1 i * w4 ) ;
X4 den=1−1.6 * exp (−1 * 1 i * w4)+0.64 * exp (−2 * 1 i * w4 ) ;
X4=X4 num . / X4 den ;
magX4=abs (X4 ) ;
phaX4=a n g l e (X4 ) ;
%G r a f i c a 1
h f i g 4=f i g u r e ;
subplot (2 ,1 ,1);
p l o t (w4/ pi , magX4 ) ;
axis ([0 1 0 40]);
wtick = [ 0 : 0 . 2 : 1 ] ;
magtick = [ 0 : 5 : 4 0 ] ;
x l a b e l ( ’ \omega/\ p i ’ ) ;
y l a b e l ( ’ |X| ’ ) ;
t i t l e ( ’ Respuesta de magnitud ’ ) ;
%G r a f i c a 2
subplot (2 ,1 ,2);
p l o t (w4/ pi , phaX4 * 180/ p i ) ;
axis ([0 ,1 , −200 ,200]);
phatick =[ −180:60:180];
x l a b e l ( ’ \omega/\ p i ’ ) ;
y l a b e l ( ’ Grados ’ ) ;
t i t l e ( ’ Respuesta de f a s e ’ ) ;
p r i n t ( h f i g 4 , ’−dpng ’ , ’ /home/ s t o r m i e s t n u t /Documents/ S o f t w a r e s c r i p t / . . .
S o f t w a r e / Matlab /PDSC/ Problema 3 / problema 03 / f i g u r a 4 . png ’ ) ;
% %Quinta f u n c i o n
%Parametros i n i c i a l e s
w5 = [ 0 : 5 0 0 ] * p i / 5 0 0 ;
X51=4 * ( ones ( s i z e (w5) ) + 0 . 7 * c o s ( 0 . 2 5 * p i ) * exp(−1 i * w5 ) ) ;
X52=ones ( s i z e (w5) ) + 1 . 4 * c o s ( 0 . 2 5 * p i ) * exp(−1 i * w5)+0.49 * exp(−1 i * 2 * w5 ) ;
X5=X51 . / X52 ;
magX5=abs (X5 ) ;
phaX5=a n g l e (X5 ) ;
%G r a f i c a 1
h f i g 5=f i g u r e ;
subplot (2 ,1 ,1);
p l o t (w5/ pi , magX5 ) ;
axis ([0 1 0 10]);
wtick = [ 0 : 0 . 2 : 1 ] ;
magtick = [ 0 : 2 : 1 0 ] ;
x l a b e l ( ’ \omega/\ p i ’ ) ;
y l a b e l ( ’ |X| ’ ) ;
t i t l e ( ’ Respuesta de magnitud ’ ) ;
%G r a f i c a 2
subplot (2 ,1 ,2);
p l o t (w5/ pi , phaX5 * 180/ p i ) ;
axis ([0 ,1 , −200 ,200]);
phatick =[ −180:60:180];
x l a b e l ( ’ \omega/\ p i ’ ) ;
y l a b e l ( ’ Grados ’ ) ;
22
t i t l e ( ’ Respuesta de f a s e ’ ) ;
p r i n t ( h f i g 5 , ’−dpng ’ , ’ /home/ s t o r m i e s t n u t /Documents/ S o f t w a r e s c r i p t / . . .
S o f t w a r e / Matlab /PDSC/ Problema 3 / problema 03 / f i g u r a 5 . png ’ ) ;
Problema 4
% %Problema 4
clc ; close all ;
h f i g 1=f i g u r e ;
w=l i n s p a c e (−pi , pi , 5 0 1 ) ;
wtick = [ − 1 : 0 . 5 : 1 ] ;
magtick = [ 0 : 0 . 5 : 1 . 1 ] ;
M=10;
n=0:M;
x=ones ( 1 , l e n g t h ( n ) ) ;
X=d t f t ( x , n ,w ) ;
magX=abs (X) ;
magX=magX/max(magX ) ;
subplot (2 ,2 ,1);
p l o t (w/ pi , magX ) ;
a x i s ([ −1 1 0 1 . 1 ] ) ;
y l a b e l ( ’ |X| ’ ) ;
t i t l e ( [ ’M = 10 ’ ] ) ;
M=25;
n=0:M;
x=ones ( 1 , l e n g t h ( n ) ) ;
X=d t f t ( x , n ,w ) ;
magX=abs (X) ;
magX=magX/max(magX ) ;
subplot (2 ,2 ,2);
p l o t (w/ pi , magX ) ;
a x i s ([ −1 1 0 1 . 1 ] ) ;
t i t l e ( [ ’M = 25 ’ ] ) ;
M=50;
n=0:M;
x=ones ( 1 , l e n g t h ( n ) ) ;
X=d t f t ( x , n ,w ) ;
magX=abs (X) ;
magX=magX/max(magX ) ;
subplot (2 ,2 ,3);
p l o t (w/ pi , magX ) ;
a x i s ([ −1 1 0 1 . 1 ] ) ;
x l a b e l ( ’ \omega/\ p i ’ ) ;
y l a b e l ( ’ |X| ’ ) ;
t i t l e ( [ ’M = 50 ’ ] ) ;
M=101;
n=0:M;
x=ones ( 1 , l e n g t h ( n ) ) ;
X=d t f t ( x , n ,w ) ;
magX=abs (X) ;
23
magX=magX/max(magX ) ;
subplot (2 ,2 ,4);
p l o t (w/ pi , magX ) ;
a x i s ([ −1 1 0 1 . 1 ] ) ;
x l a b e l ( ’ \omega/\ p i ’ ) ;
t i t l e ( [ ’M = 101 ’ ] ) ;
p r i n t ( h f i g 1 , ’−dpng ’ , ’ /home/ s t o r m i e s t n u t /Documents/ S o f t w a r e s c r i p t / . . .
S o f t w a r e / Matlab /PDSC/ Problema 3 / problema 04 / f i g u r a 1 . png ’ ) ;
Problema 7
% %Problema 7
clc ; close all ;
[ x1 , n1]= s t e p s e q ( 0 , 0 , 1 0 ) ;
[ x2 , n2]= s t e p s e q ( 1 0 , 0 , 1 0 ) ;
[ x3 , n3]= s i g a d d ( x1 , n1 ,−x2 , n2 ) ;
n=n3 ;
x =2 * (0.9.ˆ( − n ) ) . * ( c o s ( 0 . 1 * p i * n)+1 * s i n ( 0 . 9 * p i * n ) ) . * x3 ;
[ xe , xo ,m] = evenodd ( x , n ) ;
w=[ −500:500] * p i / 5 0 0 ;
X=d t f t ( x , n ,w ) ;
r e a l X=r e a l (X ) ;
imagX=imag (X ) ;
Xe=d t f t ( xe ,m,w ) ; Xo = d t f t ( xo ,m,w ) ;
d i f f e =max( abs ( realX−Xe ) ) ;
d i f f o=max( abs ( 1 i * imagX−Xo ) ) ;
h f i g 1=f i g u r e ;
subplot (2 ,2 ,1);
p l o t (w/ pi , r e a l ( Xe ) ) ;
a x i s ([ −1 1 −30 2 0 ] ) ;
w t i c k=s o r t ( [ − 1 : 0 . 4 : 1 0 ] ) ;
magtick = [ − 3 0 : 1 0 : 2 0 ] ;
x l a b e l ( ’ \omega/\ p i ’ ) ;
ylabel ( ’X e ’ );
t i t l e ( ’DTFT de x ( n ) ’ ) ;
subplot (2 ,2 ,3);
p l o t (w/ pi , r e a l X ) ;
a x i s ([ −1 1 −30 2 0 ] ) ;
w t i c k=s o r t ( [ − 1 : 0 . 4 : 1 0 ] ) ;
magtick = [ − 3 0 : 1 0 : 2 0 ] ;
x l a b e l ( ’ \omega/\ p i ’ ) ;
y l a b e l ( ’X R ’ ) ;
t i t l e ( ’ Parte r e a l :DTFT de x ( n ) ’ ) ;
subplot (2 ,2 ,2);
p l o t (w/ pi , imag (Xo ) ) ;
a x i s ([ −1 1 −30 2 0 ] ) ;
w t i c k=s o r t ( [ − 1 : 0 . 4 : 1 0 ] ) ;
magtick = [ − 3 0 : 1 0 : 2 0 ] ;
x l a b e l ( ’ \omega/\ p i ’ ) ;
ylabel ( ’X o ’ );
24
t i t l e ( ’DTFT de x ( n ) ’ ) ;
subplot (2 ,2 ,4);
p l o t (w/ pi , imagX ) ;
a x i s ([ −1 1 −30 2 0 ] ) ;
w t i c k=s o r t ( [ − 1 : 0 . 4 : 1 0 ] ) ;
magtick = [ − 3 0 : 1 0 : 2 0 ] ;
x l a b e l ( ’ \omega/\ p i ’ ) ;
ylabel ( ’ X I ’ );
t i t l e ( ’ Parte i m a g i n a r i a :DTFT o f x ( n ) ’ ) ;
p r i n t ( h f i g 1 , ’−dpng ’ , ’ /home/ s t o r m i e s t n u t /Documents/ S o f t w a r e s c r i p t / . . .
S o f t w a r e / Matlab /PDSC/ Problema 3 / problema 07 / f i g u r a 1 . png ’ ) ;
Problema 10
% %Problema 10
clc ; close all ;
M=10;
n=0:M;
Tn=(1−( abs (M−1−2*n ) / (M+ 1 ) ) ) ;
w=l i n s p a c e (−pi , pi , 5 0 1 ) ;
Tw=d t f t (Tn , n ,w ) ;
magTw=abs (Tw) ;
magTw=magTw/max(magTw ) ;
phaTw=a n g l e (Tw) * 180/ p i ;
[ x , n]= s i g f o l d (Tn , n ) ;
X=d t f t ( x , n ,w ) ;
magX=abs (X) ;
magX=magX/max(magX ) ;
phaX=a n g l e (X) * 180/ p i ;
Y= f l i p l r (Tw) ;
magY=abs (Y) /max( abs (Y ) ) ;
phaY=a n g l e (Y) * 180/ p i ;
h f i g 1=f i g u r e ;
subplot (2 ,2 ,1);
p l o t (w/ pi , magX ) ;
a x i s ([ −1 1 0 1 . 2 ] ) ;
w t i c k=s o r t ( [ − 1 : 0 . 5 : 1 ] ) ;
magtick = [ 0 : 0 . 2 : 1 . 2 ] ;
x l a b e l ( ’ \omega/\ p i ’ ) ;
y l a b e l ( ’ |X| ’ ) ;
t i t l e ( [ ’ E s c a l a de l a magnitud de X ’ ] ) ;
subplot (2 ,2 ,2);
p l o t (w/ pi , phaX ) ;
a x i s ([ −1 1 −200 2 0 0 ] ) ;
w t i c k=s o r t ( [ − 1 : 0 . 5 : 1 ] ) ;
magtick = [ − 1 8 0 : 6 0 : 1 8 0 ] ;
x l a b e l ( ’ \omega/\ p i ’ ) ;
y l a b e l ( ’ Grados ’ ) ;
t i t l e ( [ ’ Fase de X ’ ] ) ;
subplot (2 ,2 ,3);
25
p l o t (w/ pi , magY ) ;
a x i s ([ −1 1 0 1 . 2 ] ) ;
w t i c k=s o r t ( [ − 1 : 0 . 5 : 1 ] ) ;
magtick = [ 0 : 0 . 2 : 1 . 2 ] ;
x l a b e l ( ’ \omega/\ p i ’ ) ;
y l a b e l ( ’ |X| ’ ) ;
t i t l e ( [ ’ P r o p i e d a d e s de l a e s c a l a ’ ] ) ;
subplot (2 ,2 ,4);
p l o t (w/ pi , phaY ) ;
a x i s ([ −1 1 −200 2 0 0 ] ) ;
w t i c k=s o r t ( [ − 1 : 0 . 4 : 1 ] ) ;
magtick = [ − 1 8 0 : 6 0 : 1 8 0 ] ;
x l a b e l ( ’ \omega/\ p i ’ ) ;
y l a b e l ( ’ Grados ’ ) ;
t i t l e ( [ ’ P r o p i e d a d e s de f a s e ’ ] ) ;
p r i n t ( h f i g 1 , ’−dpng ’ , ’ /home/ s t o r m i e s t n u t /Documents/ S o f t w a r e s c r i p t / . . .
S o f t w a r e / Matlab /PDSC/ Problema 3 / problema 10 / f i g u r a 1 . png ’ ) ;
% %Parte 2
M=10;
n=0:M;
Tn=(1−( abs (M−1−2*n ) / (M+ 1 ) ) ) ;
w=l i n s p a c e (−pi , pi , 5 0 1 ) ;
Tw=d t f t (Tn , n ,w ) ;
magTw=abs (Tw) ;
magTw=magTw/max(magTw ) ;
phaTw=a n g l e (Tw) * 180/ p i ;
[ x1 , n1]= s i g s h i f t (Tn , n , 1 0 ) ;
[ x , n]= s i g a d d (Tn , n,−x1 , n1 ) ;
X=d t f t ( x , n ,w ) ;
magX=abs (X) ;
magX=magX/max(magX ) ;
phaX=a n g l e (X) * 180/ p i ;
Y=Tw−exp(−1 i *w * 10) * Tw;
magY=abs (Y) /max( abs (Y ) ) ;
phaY=a n g l e (Y) * 180/ p i ;
h f i g 2=f i g u r e ;
subplot (2 ,2 ,1);
p l o t (w/ pi , magX ) ;
a x i s ([ −1 1 0 1 . 2 ] ) ;
w t i c k=s o r t ( [ − 1 : 0 . 5 : 1 ] ) ;
magtick = [ 0 : 0 . 2 : 1 . 2 ] ;
x l a b e l ( ’ \omega/\ p i ’ ) ;
y l a b e l ( ’ |X| ’ ) ;
t i t l e ( [ ’ E s c a l a de magnitud de X ’ ] ) ;
subplot (2 ,2 ,2);
p l o t (w/ pi , phaX ) ;
a x i s ([ −1 1 −200 2 0 0 ] ) ;
w t i c k=s o r t ( [ − 1 : 0 . 5 : 1 ] ) ;
magtick = [ − 1 8 0 : 6 0 : 1 8 0 ] ;
x l a b e l ( ’ \omega/\ p i ’ ) ;
26
y l a b e l ( ’ Grados ’ ) ;
t i t l e ( [ ’ Fase de X ’ ] ) ;
subplot (2 ,2 ,3);
p l o t (w/ pi , magY ) ;
a x i s ([ −1 1 0 1 . 2 ] ) ;
w t i c k=s o r t ( [ − 1 : 0 . 5 : 1 ] ) ;
magtick = [ 0 : 0 . 2 : 1 . 2 ] ;
x l a b e l ( ’ \omega/\ p i ’ ) ;
y l a b e l ( ’ |X| ’ ) ;
t i t l e ( [ ’ Parametros de e s c a l a ’ ] ) ;
subplot (2 ,2 ,4);
p l o t (w/ pi , phaY ) ;
a x i s ([ −1 1 −200 2 0 0 ] ) ;
w t i c k=s o r t ( [ − 1 : 0 . 4 : 1 ] ) ;
magtick = [ − 1 8 0 : 6 0 : 1 8 0 ] ;
x l a b e l ( ’ \omega/\ p i ’ ) ;
y l a b e l ( ’ Grados ’ ) ;
t i t l e ( [ ’ P r o p i e d a d e s de l a f a s e ’ ] ) ;
p r i n t ( h f i g 2 , ’−dpng ’ , ’ /home/ s t o r m i e s t n u t /Documents/ S o f t w a r e s c r i p t / . . .
S o f t w a r e / Matlab /PDSC/ Problema 3 / problema 10 / f i g u r a 2 . png ’ ) ;
% %Parte 3
M=10;
n=0:M;
Tn=(1−( abs (M−1−2*n ) / (M+ 1 ) ) ) ;
w=l i n s p a c e (−pi , pi , 5 0 1 ) ;
Tw=d t f t (Tn , n ,w ) ;
magTw=abs (Tw) ;
magTw=magTw/max(magTw ) ;
phaTw=a n g l e (Tw) * 180/ p i ;
[ x1 , n1]= s i g f o l d (Tn , n ) ;
[ x , n]= conv m (Tn , n , x1 , n1 ) ;
X=d t f t ( x , n ,w ) ;
magX=abs (X) ;
magX=magX/max(magX ) ;
phaX = a n g l e (X) * 180/ p i ;
Y=Tw. * f l i p l r (Tw) ; magY = abs (Y) /max( abs (Y ) ) ;
phaY = a n g l e (Y) * 180/ p i ;
h f i g 3= f i g u r e ;
subplot (2 ,2 ,1);
p l o t (w/ pi , magX ) ;
a x i s ([ −1 1 0 1 . 2 ] ) ;
w t i c k=s o r t ( [ − 1 : 0 . 5 : 1 ] ) ;
magtick = [ 0 : 0 . 2 : 1 . 2 ] ;
x l a b e l ( ’ \omega/\ p i ’ ) ;
y l a b e l ( ’ |X| ’ ) ;
t i t l e ( [ ’ E s c a l a de magnitd de X ’ ] ) ;
subplot (2 ,2 ,2);
p l o t (w/ pi , phaX ) ;
a x i s ([ −1 1 −200 2 0 0 ] ) ;
w t i c k=s o r t ( [ − 1 : 0 . 5 : 1 ] ) ;
27
magtick = [ − 1 8 0 : 6 0 : 1 8 0 ] ;
x l a b e l ( ’ \omega/\ p i ’ ) ;
y l a b e l ( ’ Grados ’ ) ;
t i t l e ( [ ’ Phase o f X ’ ] ) ;
subplot (2 ,2 ,3);
p l o t (w/ pi , magY ) ;
a x i s ([ −1 1 0 1 . 2 ] ) ;
w t i c k=s o r t ( [ − 1 : 0 . 5 : 1 ] ) ;
magtick = [ 0 : 0 . 2 : 1 . 2 ] ;
x l a b e l ( ’ \omega/\ p i ’ ) ;
y l a b e l ( ’ |X| ’ ) ;
t i t l e ( [ ’ P r o p i e d a d e s de e s c a l a ’ ] ) ;
subplot (2 ,2 ,4);
p l o t (w/ pi , phaY ) ;
a x i s ([ −1 1 −200 2 0 0 ] ) ;
wtick = s o r t ( [ − 1 : 0 . 4 : 1 ] ) ;
magtick = [ − 1 8 0 : 6 0 : 1 8 0 ] ;
x l a b e l ( ’ \omega/\ p i ’ ) ;
y l a b e l ( ’ Grados ’ ) ;
t i t l e ( [ ’ P r o p i e d a d e s de f a s e ’ ] ) ;
p r i n t ( h f i g 3 , ’−dpng ’ , ’ /home/ s t o r m i e s t n u t /Documents / . . .
S o f t w a r e s c r i p t / S o f t w a r e / Matlab /PDSC/ Problema 3 / problema 10 / f i g u r a 3 . png ’
28