1
PRACTICA 3: CONVOLUCION
EJERCICIOS
1. Determinar y plotear las siguientes secuencias
𝑥(𝑛) = {1, −2,4,6, −5,8,10}
𝑥1 (𝑛) = 3𝑥(𝑛 + 2) + 𝑥(𝑛 − 4) − 2𝑥(𝑛)
𝑥2 (𝑛) = 5𝑥(5 + 𝑛) + 4𝑥(𝑛 + 4) + 3𝑥(𝑛)
𝑥3 (𝑛) = 𝑥(𝑛 + 4)𝑥(𝑛 − 1) + 𝑥(2 − 𝑛)𝑥(𝑛)
𝑥4 (𝑛) = 2𝑒 0.5𝑛 𝑥(𝑛) + cos(0.1𝜋𝑛) 𝑥(𝑛 + 2) , − 10 ≤ 𝑛 ≤ 10
𝑥5 (𝑛) = 6𝑥(−𝑛 − 5)𝑥(𝑛) − 𝛿(𝑛 + 2)
𝑥6 (𝑛) = 2𝑥(𝑛 + 1) − 𝑢(𝑛 + 2)
>> n=-4:2;x=[1 -2 4 6 -5 8 10];
>> [x11,n11]=signo(x,n,-2);
>> [x12,n12]=signo(x,n,4);
>> [x13,n13]=signo(x,n,0);
>> [x1,n1]=suma(3*x11,n11,x12,n12);
>> [x,n]=suma(x1,n1,-2*x13,n13);
>> subplot(2,3,1);stem (n,x);grid
>> xlabel('n');ylabel('x1(n)')
>> n=-4:2;x=[1 -2 4 6 -5 8 10];
>> [x14,n14]=signo(x,n,-5);
>> [x15,n15]=signo(x,n,-4);
>> [x16,n16]=signo(x,n,0);
>> [x2,n2]=suma(5*x14,n14,4*x15,n15);
>> [x3,n3]=suma(x2,n2,3*x16,n16);
>> subplot(2,3,2);stem (n3,x3);grid
>> xlabel('n');ylabel('x1(n)')
>> n=-4:2;x=[1 -2 4 6 -5 8 10];
>> [x21,n21]=signo1(x,n);
>> [x21,n21]=signo(x21,n21,2);
>> [x22,n22]=mul(x,n,x21,n21);
>> [x23,n23]=signo(x21,n21,-4);
>> [x24,n24]=signo(x21,n21,1);
>> [x25,n25]=mul(x23,n23,x24,n24);
>> [x4,n4]=suma(x22,n22,x25,n25);
>> subplot(2,3,3);stem (n4,x4)
>> xlabel('n');ylabel('x2(n)');grid
>> n=-4:2;x=[1 -2 4 6 -5 8 10];
>> [x51,n51]=signo(x,n,-2);
>> [x52,n52]=signo(x,n,0);
>> [x7,n7]=suma(2*exp(0.5*n).*x52,n52, cos(n*0.1*pi).* x51,n51);
>> subplot(2,3,4);stem (n7,x7)
>> xlabel('n');ylabel('x2(n)');grid
>> n=-4:2;x=[1 -2 4 6 -5 8 10];
>> [x31,n31]=signo1(x,n);
>> [x31,n31]=signo(x31,n31,-5);
>> [x32,n32]=mul(x,n,x31,n31);
>> [x33,n33] = impulso(-2,-4,2);
>> [x5,n5]=suma(x32,n32,-x33,n33);
>> subplot(2,3,5);stem (n5,x5)
Ing. Marco Gutiérrez Aguilar
2
>> xlabel('n');ylabel('x2(n)');grid
>> n=-4:2;x=[1 -2 4 6 -5 8 10];
>> [x41,n41]=signo(x,n,-1);
>> [x42,n42] = escalon(-2,-4,2);
>> [x6,n6]=suma(2*x41,n41,-x42,n42);
>> subplot(2,3,6);stem (n6,x6)
>> xlabel('n');ylabel('x2(n)');grid
2. Convolucion
a) y(n) = x(n)*h(n)
𝑥(𝑛) = {1,1,1,1} −5 ≤𝑛 ≤ 3
ℎ(𝑛) = {6,5,4,3,2,1} −1≤𝑛 ≤4
x=[1 1 1 1 1 1 1 1 1];
n1=-5:3;
subplot(3,1,1);stem(n1,x)
h=[7 6 5 4 3 2];
n2= -1:4
subplot(3,1,2);stem(n2,h)
y = conv(x,h)
subplot(3,1,3);stem(y)
Ing. Marco Gutiérrez Aguilar
3
b) y(n) = x(n)*h(n)
1
𝑥(𝑛) = { 𝑛[𝑢(𝑛) − 𝑢(𝑛 − 7]}
3
ℎ(𝑛) = 𝑢(𝑛 + 2) − 𝑢(𝑛 − 3)
>> n=[-20:20];
>> x = 1/3*n.*(escalon(0,-20,20) - escalon(7,-20,20));
>> h = escalon(-2,-20,20)-escalon(3,-20,20);
>> y = conv(x,h)
>> stem(y)
PRACTICA 4: MUESTREO Y DESCOMPOSICION DE SEÑALES
Ing. Marco Gutiérrez Aguilar
4
EJERCICIOS
1. Descomponer las secuencias en sus componentes pares e impares
𝑥(𝑛) = {2, −1,6,9, −5,8,1}
𝑥1 (𝑛) = 3𝑥(𝑛 + 2) + 𝑥(𝑛 − 4) − 2𝑥(𝑛)
n=-3:3;x=[2 -1 6 9 -5 8 1];
[x11,n11]=signo(x,n,-2);[x12,n12]=signo(x,n,4);[x13,n13]=signo(x,n,0);
[x11,n11]=suma(3*x11,n11,x12,n12);
[x1,n1]=suma(x11,n11,-2*x13,n13);
[xe,xo,m] = parimpar(x1,n1);
subplot(1,1,1)
subplot(3,1,1); stem(n1,x1);
xlabel('n'); ylabel('x(n)'); axis([-10,10,0,20])
subplot(3,1,2); stem(m,xe); title('par')
xlabel('n'); ylabel('xe(n)'); axis([-10,10,0,20])
subplot(3,1,3); stem(m,xo); title('impar')
xlabel('n'); ylabel('xo(n)'); axis([-10,10,-10,10])
20
x(n)
10
0
-10 -8 -6 -4 -2 0 2 4 6 8 10
n
par
20
xe(n)
10
0
-10 -8 -6 -4 -2 0 2 4 6 8 10
n
impar
10
xo(n)
-10
-10 -8 -6 -4 -2 0 2 4 6 8 10
n
𝑥2 (𝑛) = 5𝑥(5 + 𝑛) + 4𝑥(𝑛 + 4) + 3𝑥(𝑛)
n=-3:3;x=[2 -1 6 9 -5 8 1];
[x21,n21]=signo(x,n,-5);[x22,n22]=signo(x,n,-4);
[x23,n23]=signo(x,n,0);
[x21,n21]=suma(5*x21,n21,4*x22,n22);
[x2,n2]=suma(x21,n21,3*x23,n23);
[xe,xo,m] = parimpar(x2,n2);
subplot(1,1,1)
subplot(3,1,1); stem(n2,x2);
xlabel('n'); ylabel('x(n)'); axis([-10,10,0,20])
subplot(3,1,2); stem(m,xe); title('par')
xlabel('n'); ylabel('xe(n)'); axis([-10,10,0,20])
subplot(3,1,3); stem(m,xo); title('impar')
xlabel('n'); ylabel('xo(n)'); axis([-10,10,-10,10])
Ing. Marco Gutiérrez Aguilar
5
20
x(n)
10
0
-10 -8 -6 -4 -2 0 2 4 6 8 10
n
par
xe(n) 20
10
0
-10 -8 -6 -4 -2 0 2 4 6 8 10
n
impar
10
xo(n)
-10
-10 -8 -6 -4 -2 0 2 4 6 8 10
n
𝑥3 (𝑛) = 𝑥(𝑛 + 4)𝑥(𝑛 − 1) + 𝑥(2 − 𝑛)𝑥(𝑛)
n=-3:3;x=[2 -1 6 9 -5 8 1];
[x31,n31]=signo(x,n,-4);[x32,n32]=signo(x,n,1);
[x33,n33]=signo(x,n,0);
[x34,n34]=signo1(x,n);[x34,n34]=signo(x34,n34,-2);
[x31,n31]=mul(x31,n31,x32,n32);[x33,n33]=mul(x33,n33,x34,n34);
[x3,n3]=suma(x31,n31,x33,n33);
[xe,xo,m] = parimpar(x3,n3);
subplot(1,1,1)
subplot(3,1,1); stem(n3,x3);
xlabel('n'); ylabel('x(n)'); axis([-10,10,0,20])
subplot(3,1,2); stem(m,xe); title('par')
xlabel('n'); ylabel('xe(n)'); axis([-10,10,0,20])
subplot(3,1,3); stem(m,xo); title('impar')
xlabel('n'); ylabel('xo(n)'); axis([-10,10,-10,10])
20
x(n)
10
0
-10 -8 -6 -4 -2 0 2 4 6 8 10
n
par
20
xe(n)
10
0
-10 -8 -6 -4 -2 0 2 4 6 8 10
n
impar
10
xo(n)
-10
-10 -8 -6 -4 -2 0 2 4 6 8 10
n
𝑥5 (𝑛) = 6𝑥(−𝑛 − 5)𝑥(𝑛) − 𝛿(𝑛 + 2)
n=-3:3;x=[2 -1 6 9 -5 8 1];
[x41,n41]=signo1(x,n);[x41,n41]=signo(x41,n41,5);
[x42,n42]=signo(x,n,0);[x43,n43]=impseq(-2,-3,3);
Ing. Marco Gutiérrez Aguilar
6
[x41,n41]=mul(6*x41,n41,x42,n42);
[x4,n4]=suma(x41,n41,-1*x43,n43);
[xe,xo,m] = parimpar(x4,n4);
subplot(1,1,1)
subplot(3,1,1); stem(n4,x4);
xlabel('n'); ylabel('x(n)'); axis([-10,10,0,20])
subplot(3,1,2); stem(m,xe); title('par')
xlabel('n'); ylabel('xe(n)'); axis([-10,10,0,20])
subplot(3,1,3); stem(m,xo); title('impar')
xlabel('n'); ylabel('xo(n)'); axis([-10,10,-10,10])
20
x(n)
10
0
-10 -8 -6 -4 -2 0 2 4 6 8 10
n
par
20
xe(n)
10
0
-10 -8 -6 -4 -2 0 2 4 6 8 10
n
impar
10
xo(n)
-10
-10 -8 -6 -4 -2 0 2 4 6 8 10
n
2. Sea la señal 𝑥(𝑡) = cos(2𝜋𝑓𝑜 𝑡 + 𝜑), y la señal discreta generada a partir de ella xd (n)
= x (t)|t=nTs .
Graficar 20 ms de x (n), para f0 = 100, 225, 350, 475Hz, considerando que Fs=1/Ts = 8000Hz,
2000Hz, 1000Hz, 500Hz
% 4 graficos con f=100
cont=0;
for f=[100]; %225 350 475
fso=1e6;
No= fso*20e-3;
to=(0:No-1)/fso;
xo=cos(2*pi*f*to);
for fs=[8000 2000 1000 500];
N=fs*1;
t=(0:N-1)/fs;
x=cos(2*pi*f*t);
cont=cont+1;
subplot(2,2,cont);
plot(to*1e3,xo,'k',t*1e3,x,'b-o');axis([0,20,-1,1]);
title(sprintf('frec. señal:%iHz frec. muestreo:%iHz periodo
muestreo: %fms',f,fs,1e3/fs))
legend('Señal original','Señal
muestreada');xlabel('milisegundos');% pause;
end
end
Para f = 100 Hz
Ing. Marco Gutiérrez Aguilar
7
frec. señal:100Hz frec. muestreo:8000Hz periodo muestreo: 0.125000ms frec. señal:100Hz frec. muestreo:1000Hz periodo muestreo: 1.000000ms
1 1
Señal original Señal original
0.8 Señal muestreada 0.8 Señal muestreada
0.6 0.6
0.4 0.4
0.2 0.2
0 0
-0.2 -0.2
-0.4 -0.4
-0.6 -0.6
-0.8 -0.8
-1 -1
0 2 4 6 8 10 12 14 16 18 20 0 2 4 6 8 10 12 14 16 18 20
milisegundos milisegundos
frec. señal:100Hz frec. muestreo:2000Hz periodo muestreo: 0.500000ms frec. señal:100Hz frec. muestreo:500Hz periodo muestreo: 2.000000ms
1 1
Señal original Señal original
0.8 Señal muestreada 0.8 Señal muestreada
0.6 0.6
0.4 0.4
0.2 0.2
0 0
-0.2 -0.2
-0.4 -0.4
-0.6 -0.6
-0.8 -0.8
-1 -1
0 2 4 6 8 10 12 14 16 18 20 0 2 4 6 8 10 12 14 16 18 20
milisegundos milisegundos
Pa
% 4 graficos con f=225
cont=0;
for f=[225]; %225 350 475
fso=1e6;
No= fso*20e-3;
to=(0:No-1)/fso;
xo=cos(2*pi*f*to);
for fs=[8000 2000 1000 500];
N=fs*1;
t=(0:N-1)/fs;
x=cos(2*pi*f*t);
cont=cont+1;
subplot(2,2,cont);
plot(to*1e3,xo,'k',t*1e3,x,'b-o');axis([0,20,-1,1]);
title(sprintf('frec. señal:%iHz frec. muestreo:%iHz periodo
muestreo: %fms',f,fs,1e3/fs))
legend('Señal original','Señal
muestreada');xlabel('milisegundos');% pause;
end
end
% 4 graficos con f=350
cont=0;
for f=[350]; %225 350 475
fso=1e6;
No= fso*20e-3;
to=(0:No-1)/fso;
xo=cos(2*pi*f*to);
for fs=[8000 2000 1000 500];
Ing. Marco Gutiérrez Aguilar
8
N=fs*1;
t=(0:N-1)/fs;
x=cos(2*pi*f*t);
cont=cont+1;
subplot(2,2,cont);
plot(to*1e3,xo,'k',t*1e3,x,'b-o');axis([0,20,-1,1]);
title(sprintf('frec. señal:%iHz frec. muestreo:%iHz periodo
muestreo: %fms',f,fs,1e3/fs))
legend('Señal original','Señal
muestreada');xlabel('milisegundos');% pause;
end
end
% 4 graficos con f=475
cont=0;
for f=[475]; %225 350 475
fso=1e6;
No= fso*20e-3;
to=(0:No-1)/fso;
xo=cos(2*pi*f*to);
for fs=[8000 2000 1000 500];
N=fs*1;
t=(0:N-1)/fs;
x=cos(2*pi*f*t);
cont=cont+1;
subplot(2,2,cont);
plot(to*1e3,xo,'k',t*1e3,x,'b-o');axis([0,20,-1,1]);
title(sprintf('frec. señal:%iHz frec. muestreo:%iHz periodo
muestreo: %fms',f,fs,1e3/fs))
legend('Señal original','Señal
muestreada');xlabel('milisegundos');% pause;
end
end
para f = 225 Hz
frec. señal:225Hz frec. muestreo:8000Hz periodo muestreo: 0.125000ms frec. señal:225Hz frec. muestreo:2000Hz periodo muestreo: 0.500000ms
1 1
Señal original Señal original
0.8 Señal muestreada 0.8 Señal muestreada
0.6 0.6
0.4 0.4
0.2 0.2
0 0
-0.2 -0.2
-0.4 -0.4
-0.6 -0.6
-0.8 -0.8
-1 -1
0 2 4 6 8 10 12 14 16 18 20 0 2 4 6 8 10 12 14 16 18 20
milisegundos milisegundos
Ing. Marco Gutiérrez Aguilar
9
frec. señal:225Hz frec. muestreo:1000Hz periodo muestreo: 1.000000ms frec. señal:225Hz frec. muestreo:500Hz periodo muestreo: 2.000000ms
1 1
Señal original Señal original
0.8 Señal muestreada 0.8 Señal muestreada
0.6 0.6
0.4 0.4
0.2 0.2
0 0
-0.2 -0.2
-0.4 -0.4
-0.6 -0.6
-0.8 -0.8
-1 -1
0 2 4 6 8 10 12 14 16 18 20 0 2 4 6 8 10 12 14 16 18 20
milisegundos milisegundos
Para f = 350 Hz
frec. señal:350Hz frec. muestreo:8000Hz periodo muestreo: 0.125000ms frec. señal:350Hz frec. muestreo:1000Hz periodo muestreo: 1.000000ms
1 1
Señal original Señal original
0.8 Señal muestreada 0.8 Señal muestreada
0.6 0.6
0.4 0.4
0.2 0.2
0 0
-0.2 -0.2
-0.4 -0.4
-0.6 -0.6
-0.8 -0.8
-1 -1
0 2 4 6 8 10 12 14 16 18 20 0 2 4 6 8 10 12 14 16 18 20
milisegundos milisegundos
frec. señal:350Hz frec. muestreo:2000Hz periodo muestreo: 0.500000ms frec. señal:350Hz frec. muestreo:500Hz periodo muestreo: 2.000000ms
1 1
Señal original Señal original
0.8 Señal muestreada 0.8 Señal muestreada
0.6 0.6
0.4 0.4
0.2 0.2
0 0
-0.2 -0.2
-0.4 -0.4
-0.6 -0.6
-0.8 -0.8
-1 -1
0 2 4 6 8 10 12 14 16 18 20 0 2 4 6 8 10 12 14 16 18 20
milisegundos milisegundos
Para f= 475 Hz
Ing. Marco Gutiérrez Aguilar
10
frec. señal:475Hz frec. muestreo:8000Hz periodo muestreo: 0.125000ms
1
Señal original
0.8 Señal muestreada
0.6
0.4
0.2
-0.2
-0.4
-0.6
-0.8
-1
0 2 4 6 8 10 12 14 16 18 20
milisegundos
frec. señal:475Hz frec. muestreo:2000Hz periodo muestreo: 0.500000ms
1
Señal original
0.8 Señal muestreada
0.6
0.4
0.2
-0.2
-0.4
-0.6
-0.8
-1
0 2 4 6 8 10 12 14 16 18 20
milisegundos
frec. señal:475Hz frec. muestreo:1000Hz periodo muestreo: 1.000000ms
1
Señal original
0.8 Señal muestreada
0.6
0.4
0.2
-0.2
-0.4
-0.6
-0.8
-1
0 2 4 6 8 10 12 14 16 18 20
milisegundos
frec. señal:475Hz frec. muestreo:500Hz periodo muestreo: 2.000000ms
1
Señal original
0.8 Señal muestreada
0.6
0.4
0.2
-0.2
-0.4
-0.6
-0.8
-1
0 2 4 6 8 10 12 14 16 18 20
milisegundos
Ing. Marco Gutiérrez Aguilar
11
PRACTICA 5: TRANSFORMADA DE FOURIER EN TIEMPO DISCRETO DTFT
%EJERCICIO 1
%Plotear la magnitud y ángulo de 𝑋(𝑒 𝑗𝑤 )
%𝑥(𝑛) = 2(0.8)𝑛 [𝑢(𝑛) − 𝑢(𝑛 − 20)]
n=0:10;
x=((2*(0.8.^n)).*(escalon(0,0,10)-escalon(20,0,10)));
k = -200:200; w=(pi/100)*k;
X =x*(exp(-j*pi/100)).^(n'*k); %DTFT usando matrix-vector
magX = abs(X);angX=angle(X);
subplot(2,2,1);plot(w/pi,magX);grid
xlabel('Frecuencia');title('Magnitud');
subplot(2,2,2);plot(w/pi,angX/pi);grid
xlabel('Frecuencia');title('angulo');
%EJERCICIO 2
%x(n) = 2n − 10 ≤ n ≤ 10
n=-10:10;
x=(2.^n);
k = -200:200; w=(pi/100)*k;
X =x*(exp(-j*pi/100)).^(n'*k); %DTFT usando matrix-vector
magX = abs(X);angX=angle(X);
subplot(2,2,3);plot(w/pi,magX);grid
xlabel('Frecuencia');title('Magnitud');
subplot(2,2,4);plot(w/pi,angX/pi);grid
xlabel('Frecuencia');title('angulo');
Determinar 𝑋(𝑒 𝑗𝑤 ) e investigar si la señal es periódica.
EJERCICIOS PROPUESTOS
1. Para cada función determinar DTFT 𝑋(𝑒 𝑗𝑤 ). Plotear la magnitud y ángulo de 𝑋(𝑒 𝑗𝑤 )
𝑥(𝑛) = 𝑛(0.9)𝑛 [𝑢(𝑛) − 𝑢(𝑛 − 50)]
𝑥(𝑛) = {𝟒, 3,2,1,2,3,4}
Ing. Marco Gutiérrez Aguilar
12
𝑥(𝑛) = {𝟒, 3,2,1,0, −1, −2, −3, −4}
n=0:10;
x=((n.*(0.9.^n)).*(escalon(0,0,10)-escalon(50,0,10)));
k = -200:200; w=(pi/100)*k;
X =x*(exp(j*pi/100)).^(n'*k); %DTFT usando matrix-vector
magX = abs(X);angX=angle(X);
subplot(3,2,1);plot(w/pi,magX);grid
xlabel('Frecuencia');title('Magnitud');
subplot(3,2,2);plot(w/pi,angX/pi);grid
xlabel('Frecuencia');title('angulo');
n=0:6;
x=[ 𝟒, 3,2,1,2,3,4];
k = -200:200; w=(pi/100)*k;
X =x*(exp(j*pi/100)).^(n'*k); %DTFT usando matrix-vector
magX = abs(X);angX=angle(X);
subplot(3,2,3);plot(w/pi,magX);grid
xlabel('Frecuencia');title('Magnitud');
subplot(3,2,4);plot(w/pi,angX/pi);grid
xlabel('Frecuencia');title('angulo');
n=0:8;
x=[𝟒, 3,2,1,0, −1, −2, −3, −4];
k = -200:200; w=(pi/100)*k;
X =x*(exp(j*pi/100)).^(n'*k); %DTFT usando matrix-vector
magX = abs(X);angX=angle(X);
subplot(3,2,5);plot(w/pi,magX);grid
xlabel('Frecuencia');title('Magnitud');
subplot(3,2,6);plot(w/pi,angX/pi);grid
xlabel('Frecuencia');title('angulo');
2. Determinar y analizar la DTFT para cada una de las secuencias. Plotear magnitud y
angulo usando Matlab (comentar las graficas ploteadas)
%𝑥(𝑛) = 3(0.9)3 𝑢(𝑛)
Ing. Marco Gutiérrez Aguilar
13
n=0:10;
x=((3*((0.9).^3)).*(escalon(0,0,10)));
k = -200:200; w=(pi/100)*k;
X =x*(exp(-j*pi/100)).^(n'*k); %DTFT usando matrix-vector
magX = abs(X);angX=angle(X);
subplot(3,2,1);plot(w/pi,magX);grid
xlabel('Frecuencia');title('Magnitud');
subplot(3,2,2);plot(w/pi,angX/pi);grid
xlabel('Frecuencia');title('angulo');
%𝑥(𝑛) = 2(0.8)𝑛+2 𝑢(𝑛 − 2)
n=0:10;
x=((2*((0.8).^(n+2))).*(escalon(2,0,10)));
k = -200:200; w=(pi/100)*k;
X =x*(exp(-j*pi/100)).^(n'*k); %DTFT usando matrix-vector
magX = abs(X);angX=angle(X);
subplot(3,2,3);plot(w/pi,magX);grid
xlabel('Frecuencia');title('Magnitud');
subplot(3,2,4);plot(w/pi,angX/pi);grid
xlabel('Frecuencia');title('angulo');
%𝑥(𝑛) = 𝑛(0.5)3 𝑢(𝑛)
n=0:10;
x=((n.*((0.5).^(3))).*(escalon(0,0,10)));
k = -200:200; w=(pi/100)*k;
X =x*(exp(-j*pi/100)).^(n'*k); %DTFT usando matrix-vector
magX = abs(X);angX=angle(X);
subplot(3,2,5);plot(w/pi,magX);grid
xlabel('Frecuencia');title('Magnitud');
subplot(3,2,6);plot(w/pi,angX/pi);grid
xlabel('Frecuencia');title('angulo');
%𝑥(𝑛) = (𝑛 + 2)(−0.7)𝑛−1 𝑢(𝑛 − 2)
n=0:10;
x=(((n+2).*((-0.7).^(n-1))).*(escalon(2,0,10)));
k = -200:200; w=(pi/100)*k;
X =x*(exp(-j*pi/100)).^(n'*k); %DTFT usando matrix-vector
Ing. Marco Gutiérrez Aguilar
14
magX = abs(X);angX=angle(X);
subplot(2,2,1);plot(w/pi,magX);grid
xlabel('Frecuencia');title('Magnitud');
subplot(2,2,2);plot(w/pi,angX/pi);grid
xlabel('Frecuencia');title('angulo');
%𝑥(𝑛) = 5(−0.9)𝑛 cos(0.1𝜋𝑛)𝑢(𝑛)
n=0:10;
x=((5*((-0.9).^n)).*cos(0.1*pi*n).*(escalon(0,0,10)));
k = -200:200; w=(pi/100)*k;
X =x*(exp(-j*pi/100)).^(n'*k); %DTFT usando matrix-vector
magX = abs(X);angX=angle(X);
subplot(2,2,3);plot(w/pi,magX);grid
xlabel('Frecuencia');title('Magnitud');
subplot(2,2,4);plot(w/pi,angX/pi);grid
xlabel('Frecuencia');title('angulo');
Ing. Marco Gutiérrez Aguilar