Universidad San Francisco de Quito

February 10, 2014

Ronny Ramírez
Deber 2
3.1
1.

%%
%3.1
function [X k] = dtft(x,n,w)
k=w/pi;
W=exp(-1j*pi/500).^(n'*k); X=x*W;
end
w=-pi:pi/500:pi;
%1
n1=-10:10;
x1=0.6.^abs(n1);
[X1 k] = dtft(x1,n1,w);

1

El ángulo varía signicativamente cuando la frecuencia se incrementa de [0, π]
2.

%2

n2=0:20;
x2=n2.*0.9.^n2;
[X2 k] = dtft(x2,n2,w);

2

3.

%3

n3=0:50;
x3=cos(0.5*pi*n3)+1j*sin(0.5*pi*n3);
[X3 k] = dtft(x3,n3,w);

3

Se puede observar que la magnitud se incrementa mientras que la fase decrece cuando se varia la frecuencia.
4

%4

n4=0:7;
x4=[4 3 2 1 1 2 3 4];
[X4 k] = dtft(x4,n4,w);

4

[X5 k] = dtft(x5.w). 5 . 5 %5 n5=0:7.Se puede observar que el ángulo varía levemente cuando se incrementa la frecuencia.n5. x5=[4 3 2 1 -1 -2 -3 -4].

k=w/pi.25*(exp(1j*2.*w)+exp(1j.*w)+1. 3. 6 .3 w=0:pi/500:pi./(1-exp(1j. 1 %1 X1=0.*w))).Se puede observar que el ángulo da un salto cuando frecuencia es igual a cero.

*exp(1j.^10).*w)).*exp(-1j. 7 .6.*exp(-1j.6.*w))-1+(1-(0.^10)./(1-0.2 %2 X2=(1-(0.*w)).6.*w)).*exp(1j.6./(1-0.

12.*exp(1j*3.3 %3 X3=1j*(1.*w)).*exp(1j.*exp(-1j.*w)).*exp(-1j.11. 8 .*w)).^2-4.9.9.*w)./(1-0./(1-0.

*exp(-1j.*exp(-1j.*w)).*exp(-1j*2.*w).8.^2+4. 9 .*w)./(1-0.*w)).4 %4 X4=1j*0./(1-0.8.512-exp(-1j.

7.*w)).*exp(-1j./(1+(0.^2).5 %5 X5=4. 10 .

n1.54-0. T1=1-abs(M1-1-2*n1)/(M1+1).4 M1=10. M4=101. M2=25. H1=0. [Rf1 k] = dtft(R1.5*(1-cos((2*pi*n1)/(M1-1))). M3=50. 11 .w). n1=0:M1-1. w=-pi:pi/500:pi. R1=ones(1.length(n1)).3.46*cos((2*pi*n1)/(M1-1)). C1=0.

w).n1.[Cf1 k] = dtft(C1. 12 .

w).[Tf1 k] = dtft(T1. 13 .n1.

14 .n1.[Hf1 k] = dtft(H1.w).

n2. T2=1-abs(M2-1-2*n2)/(M2+1). C2=0.length(n2)).n2=0:M2-1.46*cos((2*pi*n2)/(M2-1)).w). R2=ones(1. 15 .54-0. H2=0.5*(1-cos((2*pi*n2)/(M2-1))). [Rf2 k] = dtft(R2.

n2. 16 .w).[Cf2 k] = dtft(C2.

n2.[Tf2 k] = dtft(T2.w). 17 .

18 .w).[Hf2 k] = dtft(H2.n2.

H3=0. [Rf3 k] = dtft(R3. 19 .46*cos((2*pi*n3)/(M3-1)). C3=0.w).5*(1-cos((2*pi*n3)/(M3-1))). R3=ones(1.n3.length(n3)).54-0. T3=1-abs(M3-1-2*n3)/(M3+1).n3=0:M1-1.

w).[Cf3 k] = dtft(C3.n3. 20 .

n3. 21 .w).[Tf3 k] = dtft(T3.

22 .[Hf3 k] = dtft(H3.w).n3.

w). H4=0.n4=0:M4-1.length(n4)). 23 .5*(1-cos((2*pi*n4)/(M4-1))).n4. R4=ones(1. [Rf4 k] = dtft(R4.54-0. T4=1-abs(M4-1-2*n4)/(M4+1).46*cos((2*pi*n4)/(M4-1)). C4=0.

24 .w).n4.[Cf4 k] = dtft(C4.

25 .n4.[Tf4 k] = dtft(T4.w).

n4.[Hf4 k] = dtft(H4. 26 .w).

abs(1j*Xi-Xo)) ylabel('Magnitud').n.8 n=0:19.1. xc=conj(x). xi=imag(x). subplot(2.abs(Xr-Xe)) t itle('DTFT').w). [X k] = dtft(x. [Xr k] = dtft(xr.8 %3.1.w).*n).n.3.xlabel('frecuencia (rad/s)') 27 . x=exp(1j*0.1*pi. [Xc k] = dtft(xc. w=-pi:pi/500:pi.2) plot(k.w).ylabel('Magnitud') subplot(2.n.6 Entregado a mano 3.1) plot(k.n. Xe=1/2*(X+Xc).w). Xo=1/2*(X-Xc). xr=real(x). [Xi k] = dtft(xi.

10 M=10. n=0:M-1. x=T10.10 %3. 28 . 1 %1 X1=conj(X).w).n. w=-pi:pi/500:pi. T10=1-abs(M-1-2*n)/(M+1).3. [X k] = dtft(x.

*exp(1j.2 %2 X2=X-X.*w*10). 29 .

*X1.3 %3 X3=X. 30 .

31 .4 %4 [X4 k4]=sigshift(X.pi).k.

k5=-1:1/1000:1.1*pi. [Xcos k] = dtft(xcos. 32 .Xcos). X5=conv(X.w).n.*n).5 %5 xcos=cos(0.

14 1 Entregado a mano.3.n. n=0:N-1. 3 %3 wd=-wc:pi/500:wc.*(n-a)/pi).*wd)zeros(1.length(wc:pi/500:pi)-1)]. 2 %2 N=41. wc=0.5*pi. 33 . Hd=[zeros(1. [H k] = dtft(h. a=20. h=wc/pi*sinc(wc. w=-pi:pi/500:pi.w).length(-pi:pi/500:-wc)-1)exp(-1j*a.

5*pi. h=sinc(n-a)-sin(wc. w=-pi:pi/500:pi. n=0:N-1./(pi. wc=0.length(-wc:pi/500:wc)-2)exp(-1j*a.n.*(n-a)).*wd2)].15 1 Entregado a mano 2 %2 N=31.w). a=15.*wd1)zeros(1. 3 %3 wd1=-pi:pi/500:-wc.*(n-a)). 34 . [H k] = dtft(h. wd2=wc:pi/500:pi. Hd=[exp(-1j*a.3.

531]. a=[1 0 -0. N=size(a)-1. end 3.*w*l). end for l=1:N S2=S2+a(l+1).18 %% %3.w) M=size(b)-1. b=[1 0 1 0 1 0 1]./(1+S2).*exp(-1j.18 n=0:200. end H=S1.81 0 -0.*w*m). 35 .3.16 function [H] = freqresp(b. S1=0.656 0 -0. S2=0. for m=0:M S1=S1+b(m+1).*exp(-1j.a.

5*pi.a.x1).x2).a. y1=lter(b.*n+pi/2).^n.1 %1 x1=5+10*(-1). y2=lter(b. 2 %2 x2=1+cos(0. 36 .

*n/4).3 %3 x3=2*sin(pi. y3=lter(b. 37 .a.x3).*n/4)+3*cos(3*pi.

*n/4). for k=0:5. end y4=lter(b. 38 .a.4 %4 x4=0. x4=x4+(k+1)*cos(pi*k.x4).

x5).5 %5 x5=cos(pi.*n). 39 .a. y5=lter(b.

0001:0.*t1).001:0.*t2). x2=sin(1000*pi.1.1. x1=sin(1000*pi. 40 . 2 %2 t2=0:0.3.19 1 %1 t1=0:0.

*t3).01:0. 41 . x3=sin(1000*pi.1.3 %3 t3=0:0.