exp 5

Upload: ankita-bharti

Post on 07-Jan-2016

218 views

Category:

Documents


0 download

DESCRIPTION

hjkkkkll

TRANSCRIPT

In Lab ExcersiceQ1 . Determine the time signals represented by following dtfs coefficient.

ak=1+cos(5k/9)+jsin(7k/27)

program

k=0:53;ak=1+cos(5*pi*k/9)+j*sin(7*pi*k/27);N=54;for i=0:N-1 xn=0; for k=0:N-1 xn(k+1)=ak(k+1).* exp(2*j.*(pi./N).*k.*i); endx(i+1)=sum(xn);endsubplot(2,1,1)stem(0:53,x./N)subplot(2,1,2)stem(0:53,ifft(ak))

Q2. Calculate DTFT and DFT of signal, x[n]. Plot magnitude and phase spectra. Verify your answer. x[n]=(1/3)^|n|.u(-n-2)Program%dtftn=-20:20;w=-pi:0.1:pi;u=@(n)(1.*(n>=0));x=((1/3).^abs(n).*u(-n-2));for m=1:length(w)s=0;for l=1:length(n) X(l)=x(l).*exp((-1j).*w(m).*n(l)); s=s+sum(X);ends1(m)=s;endsubplot(3,1,1)stem(1:length(w),(s1))s2=abs(s1);subplot(3,1,2)stem(s2)s3=angle(s1);subplot(3,1,3)stem(s3)

%DFTn=-20:20;N=8;u=@(n)(1.*(n>=0));x=((1/3).^abs(n).*u(-n-2));for m=1:length(w)s=0;for l=1:length(n) X(l)=x(l).*exp((-1*2*pi*j).*m./N.*n(l)); s=s+sum(X);ends1(m)=s;endsubplot(3,1,1)stem(1:length(w),(s1))s2=abs(s1);subplot(3,1,2)stem(s2)s3=angle(s1);subplot(3,1,3)stem(s3)

Post labQ1.Use the defining equation for the DTFS coefficients to evaluate the FSrepresentation of discrete time signal.x[n] =1+cos(3n /12)+sin(2n / 36)Sketch the magnitude and phase spectra. Verify answer using fft.n=0:71;x=(1+cos(3.*pi.*n./12)+sin(2.*pi.*n./36));N=72;for i=0:N-1 xn=0; for k=0:N-1 xn(k+1)=(x(k+1).*exp(-2.*pi.*1j./N.*k.*i)); end ak(i+1)=sum(xn);endsubplot(4,1,1)stem(0:71,ak)subplot(4,1,2)stem(0:71,fft(x))y=abs(ak);z=angle(ak);subplot(4,1,3)stem(y)subplot(4,1,4)stem(z)

2. Determine DTFT and DFT of signal, x[n] = ((1/3) n cos (3n)) u [n + 2].n=-20:20;x=(1/3).^n.*cos(3.*n).*1.*(n+2>=0);w=-pi:0.1:pi;for m=1:length(w)s=0;for l=1:length(n) X(l)=x(l).*exp((-1j).*w(m).*n(l)); s=s+sum(X);ends1(m)=s;endsubplot(3,1,1)stem(1:length(w),(s1))s2=abs(s1);subplot(3,1,2)stem(s2)s3=angle(s1);subplot(3,1,3)stem(s3)

n=-20:20;N=8;x=(1/3).^n.*cos(3.*n).*1.*(n+2>=0);for m=1:length(w)s=0;for l=1:length(n) X(l)=x(l).*exp((-1*2*pi*j).*m./N.*n(l)); s=s+sum(X);ends1(m)=s;endsubplot(3,1,1)stem(1:length(w),(s1))s2=abs(s1);subplot(3,1,2)stem(s2)s3=angle(s1);subplot(3,1,3)stem(s3)