24 views

Uploaded by Dhiraj Thakur

- 64 Point Fast Fourier Transform Circuit
- DSP matlab for DFT n IIFT
- Continuous Neural Networks
- 12-244
- Zero Padding
- DSP Expected Questions
- Elex Sem VI
- Digital Signal Processing
- Freq Intro
- FFT Algorithm
- DSP Principles Algorithms and Applications Third Edition
- INTERNAL I SET II.docx
- Lecture11
- Awwal - Field Guide to Image Processing (2012)
- ADIPCV_tutorial_sample
- Kumpulan Program Metnum
- 2014 2 SARAWAK SMKStJoseph Kuching MATHS QA
- Quiz A(n)
- Pdm 82 Aligned My36n
- env68 8 06 07 kc

You are on page 1of 18

FACULTY NAME :

th

E. NO. :11414802809

Maharaja Agrasen Institute of Technology, PSP area, Sector 22, Rohini, New Delhi 110085

INDEX

S.No.

1.

Introduction to MATLAB Program for generation of sin, cos, exponential, unit impulse, step function, square wave a) To generate convolved output of two sample sequences. b) To determine the correlation of two sequences. To determine DTFT of a given sequence An LTI system is specified by the difference equation Y(n)=0.8*Y(n-1)+x(n) (a) Determine H(exp(jw)) (b) Calculate & plot the steady state response Yss (n) to x(n)=cos(0.5n) u(n) Let x(n) be 4 point sequence X(n)=1 ; 0=< n =<3 =0 ; elsewhere Compute the 4-point DFT and 8-point DFT and plot their magnitude and phase plot.

Date

Remarks

2.

3.

4. 5.

6.

INTRODUCTION TO MATLAB

The name MATLAB stands for MATrix LABoratory. MATLAB was written originally to provide easy access to matrix software developed by the LINPACK (linear system package) and EISPACK (Eigen system package) projects. MATLAB is a high performance language for technical computing. It integrates computation, visualization, and programming environment. Furthermore, MATLAB is a modern programming language environment: it has sophisticated data structures, contains built-in editing and debugging tools, and supports object-oriented programming. These factors make MATLAB an excellent tool for teaching and research. MATLAB has many advantages compared to conventional computer languages (e.g. C, FORTRAN) for solving technical problems. MATLAB is an interactive system whose basic data element is an array that does not require dimensioning. The software package has been comercia-lly available since 1984 and is now considered as a standard tool at most universities and industries worldwide. It has powerful built-in routines that enable a very wide variety of computations. It also has easy to use graphics commands that make the visualization of results immediately available. Specific applications are collected in packages referred to as toolbox. There are toolboxes for signal processing, symbolic computation, control theory, simulation, optimization, and several other fields of applied science and engineering.

EXPERIMENT No. 2 AIM Program for generation of sin, cos, exponential, unit impulse, step function, square wave. THEORY Sine Function: A function f(x)=sin(x) is a periodic function with a period of 2, it will form a periodic wave after 2. The f(x) will lie between -1 to +1. Cosine Function: A function f(x)=cos(x) is a periodic function with a period of 2, it will form a periodic wave after 2. Exponential Function: A function f(x)=ex is defined as: 0<f(x)1; 1f(x)<; for -x0 for 0x

Unit impulse Function: Unit impulse is a signal that is 0 everywhere except at n=0 where it is 1. In discrete time domain the unit impulse signal is defined as: (n) =1; = 0; n=0 elsewhere

Unit Step Function: The integral of the impulse function is a unit step signal. In discrete time unit step signal is defined as: U(n) =1; = 0; n>=0 n<0

Square Wave Function: It is a periodic function with a period of T. If f(x) is a square wave function then F(x) = 1; 0<x<T/2 = -1; T/2<x<T

MATLAB CODE

t=0:0.01:pi; x=sin(2*pi*t); y=cos(2*pi*t); z1=exp(2* t); z2=exp(2*(-t)); subplot(2,2,1); plot(x); xlabel('Time'); ylabel('Amplitude'); title('Sine Wave'); subplot(2,2,2); plot(y); xlabel('Time'); ylabel('Amplitude'); title('Cosine Wave'); subplot(2,2,3); plot(z1); xlabel('Time'); ylabel('Amplitude'); title('Exponential Rising'); subplot(2,2,4); plot(z2); xlabel('Time'); ylabel('Amplitude'); title('Exponential Falling'); h(5)=1; for i=1:4 h(i)=0; end; for i=6:10 h(i)=0; end; m=-4:5; figure; subplot(2,2,1); stem(m,h); xlabel('Time'); ylabel('Amplitude'); title('Unit Impulse'); for j=1:4 g(j)=0; end; for j=5:10 g(j)=1; end; subplot(2,2,2); stem(m,g); xlabel('Time'); ylabel('Amplitude'); title('Step Function'); a=1;b=5;c=6;d=10; for p=1:4 for k=a:b s(k)=1;

end; for k=c:d s(k)=-1; end; a=a+10; b=b+10; c=c+10; d=d+10; end; n=0:39; subplot(2,2,3); stem(n,s); xlabel('Time'); ylabel('Amplitude'); title('Square Wave');

OUTPUT

AIM

To generate convolved output of two sample sequences.

THEORY

A convolution is an integral that expresses the amount of overlap of one function as it is shifted over another function. It therefore blends from one function to another. For example, in synthesis imaging, the measured dirty map is a convolution of the true CLEAN map with the dirty beam. This formula gives response y(n) of the LTI system as a function of the input signal x(n) and the unit sample response h(n) is called CONVOLUTION SUM. We say that the input x(n) is convolved with the impulse response h(n) to yield the output y(n). The process of computing the convolution between x(k) and h(k) involves the following steps: 1. Folding: Fold h(k) about k=0 to obtain h(-k). 2. Shifting: Shift h(-k) by n to the right(left) if n is positive(negative) to obtain h(n-k). 3. Multiplication: Multiply x(k) by h(n-k) to obtain the value of the output sequence v(k) = x(k)h(n-k). 4. Summation: Sum all the values of the product sequence v(k) to obtain the value of the output at a given time . PROPERTIES OF CONVOLUTION 1. COMMUTATIVE LAW: x(n)*h(n) = h(n)* x(n) 2. ASSOCIATIVE LAW: [x(n)*h1(n)]*h2(n) = x(n)*[h1(n)*h2(n)] 3. DISTRIBUTIVE LAW: x(n)*[h1(n)+h2(n)] = x(n)*h1(n) + x(n)*h2(n)

MATLAB CODE

close all clear all x=[1 1 1 1 1 0 0 0 0 0 0 0 0 0] h=[1 1 1 1 1 0 0 0 0 0 0 0 0 0] m=length(x); n=length(h); X=[x,zeros(1,n)]; H=[h,zeros(1,m)]; for i=1:n+m-1 Y(i)=0; for j=1:m if(i-j+1>0) Y(i)=Y(i)+X(j)*H(i-j+1); else end end end stem(Y); ylabel('Y[n]'); xlabel('----->n'); figure; stem(n,y); xlabel('Time'); ylabel('Amplitude'); title('Convolved Output');

OUTPUT

AIM

To determine the correlation of two sequences.

THEORY:

Suppose that we have two signal sequences x(n) and y(n) each of which has finite energy. The cross correlation of x(n) and y(n) is a sequence rxy(l), which is defined as r xy (l) = or equivalently as r xy (l) = x(n+l) y(n) x(n) y(n-l)

the index l is the time shift (or lag) parameter and the subscript xy on the cross correlation sequence r xy (l) indicates the sequence being correlated. The order of the subscript, with x preceding y, indicates the direction in which one sequence is shifted relative to other. If we reverse the role of x(n) and y(n) in above equation we obtain the correlation sequence r yx (l) = or equivalently as r yx (l) = by comparing the equations r xy (l) = r yx (-l) therefore r yx (l) is simply folded version of r xy (l) where the folding is done with respect to l=0.In the special case where y(n)=x(n) , we have AUTOCORRELATION of x(n) which is defined as the sequence r xx (l) = or equivalently as r xx (l) = x(n+l) x(n) x(n) x(n-l) y(n+l) x(n) y(n) x(n-l)

CONCLUSION: The convolution of two discrete time signals has been found resultant signal is shown wave form. MATLAB CODE

x=[2 -1 3 7 1 2 -3 0 0 0 0 0 0 0]; y=[0 0 0 0 0 0 0 0 0 1 -1 2 -2 4 1 -2 5]; h=fliplr(y); k1=-4; k2=-3; k3=2; k4=4; ler=k1+k2; rey=k3+k4; for n=ler:rey n1=n+8; r(n1)=0; for k=k1:(n1-k2) a=k+5; b=(n-k)+4; if b<=0 break; end r(n1)=r(n1)+((x(a)).*(h(b))); end end n=ler:rey; stem(n,r); xlabel('time'); ylabel('amplitude'); title('correlated output->y');

OUTPUT

EXPERIMENT No.- 4

clc clear w=linspace(0,2*pi,500) X=exp(j*w)./(exp(j*w)-0.5*ones(1,500)) magX=abs(X) phX=angle(X) realX=real(X) imgX=imag(X) subplot(2,2,1) stem(magX) xlabel('w') ylabel('Mag X') title('Magnitude plot') subplot(2,2,2) stem(phX) xlabel('w') ylabel('Phase X') title('Phase plot') subplot(2,2,3) stem(realX) xlabel('w') ylabel('Real X') title('Real X plot') subplot(2,2,4) stem(imgX) xlabel('w') title('Img X plot') ylabel('Img X')

OUTPUT

EXPERIMENT No.- 5

AIM An LTI system is specified by the difference equation Y(n)=0.8*Y(n-1)+x(n) (c) Determine H(exp(jw)) (d) Calculate & plot the steady state response Yss (n) to x(n)=cos(0.5n) u(n)

THEORY

Y(n) = 0.8Y(n-1)+x(n) Taking DTFT Y(ejw) = 0.8 e-jwY(ejw) + x(ejw) Hence H(w) = Y(ejw)/x(ejw) = 1/[1-0.8 ejw] | H(w)|=4.0928 H(w)=-0.5377 Yss=4.0928 cos(0.05**n 0.5377) Yss=4.0928 cos ( 0.05* (n-3.42))

MATLAB CODE

b=1; a=[1,-0.8]; n=0:100; x=cos(0.05*pi*n); y=filter(b,a,x); Yss=filter(b,a,x); subplot(2,1,1) stem(Yss) ylabel('Yss') xlabel('x[n]') title('Steady state plot') subplot(2,1,2) stem(x[n]) stem(x) ylabel('x[n]') xlabel('n') title('Input function plot')

OUTPUT

EXPERIMENT NO.6

AIM:

Let x(n) be 4 point sequence X(n)=1 ; 0=< n =<3 =0 ; elsewhere Compute the 4-point DFT and 8-point DFT and plot their magnitude and phase plot.

THEORY:

The discrete Fourier transform computes the values of the z transform for evenly spaced points around the unit circle for a given sequence. If the sequence to be represented is of finite duration, i.e., has only a finite number of nonzero values, the transform is discrete Fourier transform.

N-1

n=0

kn/N

N-1

n=0

kn/N

k = 0,1,2..,N-1

3

n=0

kn/4

2/4 -j2k/4

+x(2) e

3/4

-j2k2/4

+x(3) e-j2

k3/4

+e-j2

2 /4

+e-j2 +e-j2

4/4

+e-j2 +e-j2

6/4

3 /4

6/4

9/4

X(n) = {1,1,1,1,0,0,0,0}

N-1

n=0

kn/N

k = 0,1,2..,N-1

7

n=0

kn/8

k5/8 k/8

+x(2) e-j2

k6/8 k2/8

k2/8

+x(3) e-j2

k7/8 k3/8

k3/8

+x(4) e-j2

k4/8

+x(6) e-j2

+x(7) e-j2

k/8

+x(3) e-j2

X(0) = 1+1+1+1 = 4 X(1) = 1+ e-j2 /8 +e-j2 = 1-2.414j X(2) = 1+ e-j2 =0 X(3) = 1+ e-j2 X(4) = 1+ e-j2 =0 X(5) = 1+ e-j2 X(6) = 1+ e-j2 =0

5 /8 3 /8 2 /4 2/8 3/8

4/4

+e-j2 +e-j2

6/4

6/8

9/8

= 1-0.414j

4 /8 8 /8

+e-j2

12/8

10/8

+e-j2

15/8

= 1+0.414j

6/8 12/8

+e-j2

18/8

X(7) = 1+ e-j2

7/8

+e-j2

14/8

+e-j2

21/8

= 1+2.414j

MATLAB CODE

clc; clear; x=[1,1,1,1] for k=0:3, Xdft(k+1)=0, for n=0:3, Xdft(k+1)=Xdft(k+1)+x(n+1)*exp(-j*pi*n*k/2), end end Xmag=abs(Xdft); Xphase=angle(Xdft); figure; subplot(2,2,1) stem(Xmag) title('Magnitude Xdft (4 Point)') xlabel('k') ylabel('Mag Xdft') subplot(2,2,2) stem(Xphase) title('Phase Xdft (4 Point)') ylabel('Phase Xdft') xlabel('k') clear; x=[1,1,1,1,0,0,0,0]; for k=0:7, Xdft(k+1)=0; for n=0:7, Xdft(k+1)=Xdft(k+1)+x(n+1)*exp(-j*pi*n*k/2); end end Xmag=abs(Xdft); Xphase=angle(Xdft); subplot(2,2,3) stem(Xmag) title('Magnitude Xdft (8 Point)') xlabel('k') ylabel('Mag Xdft') subplot(2,2,4) stem(Xphase) title('Phase Xdft (8 Point)') ylabel('Phase Xdft')

xlabel('k')

OUTPUT

- 64 Point Fast Fourier Transform CircuitUploaded byMurali
- DSP matlab for DFT n IIFTUploaded bydeeptakshd
- Continuous Neural NetworksUploaded byJason Kuen
- 12-244Uploaded byRenzo Arango
- Zero PaddingUploaded bysum1oru
- DSP Expected QuestionsUploaded byRaj Mygame
- Elex Sem VIUploaded byNikhil Velguenkar
- Digital Signal ProcessingUploaded byAvinitsaha
- Freq IntroUploaded byJaya
- FFT AlgorithmUploaded byVenkat Parthasarathy
- DSP Principles Algorithms and Applications Third EditionUploaded byHarish Gunasekaran
- INTERNAL I SET II.docxUploaded bySHAIK ROSHAN
- Lecture11Uploaded byshweta_lakshmanan
- Awwal - Field Guide to Image Processing (2012)Uploaded bysebastian
- ADIPCV_tutorial_sampleUploaded byShashaank Mattur Aswatha
- Kumpulan Program MetnumUploaded byFrizikha Nichlany
- 2014 2 SARAWAK SMKStJoseph Kuching MATHS QAUploaded bySK
- Quiz A(n)Uploaded byHoàng Minh Măng
- Pdm 82 Aligned My36nUploaded byArbaz
- env68 8 06 07 kcUploaded byapi-367296283
- POSTER ICOBIO NENDEN.pptxUploaded byNSiti Nurkholipah
- assAsUploaded byMukesh Bisht
- 12 (1).pdfUploaded byPrashant Choudhary
- env68 8 06 04 kcUploaded byapi-367296283
- CProsolsUploaded byK Nirmala Anantapur
- 481601Uploaded byDwiki Ananda Putra
- Paper Spa Rev MayWFUploaded bymOchO
- HW#11_SolUploaded bySYZC
- Skew Detection and CorrectionUploaded byAnonymous Ys17x7
- Solucionarios Calculo Fisica Mecanica Algebra Vectoria Logistica Dinamica Estatica EtcUploaded byalxeslavas

- Power OptionsUploaded byJoey Buck
- DSP Viva QuestionsUploaded byPrashant Sangulagi
- DFS_DTFT_DFTUploaded byravigwl
- DFT Processing for Guitar TunerUploaded byAnonymous xrRoLaoCBG
- Anna University Digital Signal Processing Question BankUploaded bys.ranjith
- Smith J - Mathematics of the Discrete Fourier TransformUploaded byJayashree Ravindranath
- M. TECH PART-2Uploaded byRavinder Pal Singh Harry
- VIBRASI_SE~3 (Level2)Uploaded byyerin
- Peak to Average Power Ratio (Papr) ...PDFUploaded byabdul.azeez
- Lyons FFT Interpolation Based on FFT Samples.pdfUploaded byjarrero
- CS331 Digital Signal Processing Nov Dec 2005Uploaded byChandru Sekar
- Implementation Of Fast Fourier Transform (FFT) Using VHDLUploaded byCutie
- Phase1 ReportUploaded byjeevrkg
- Linear ConvolutionUploaded byHarsha
- nba documentUploaded bymanjunath
- Time Series Similarity MeasureUploaded byDiego Fustes Villadóniga
- Fundamentals of Electrical EngineeringUploaded byvsorana
- AIUB SYLLBOOK1Uploaded byMartin7_1
- IPUploaded byPreeti Sonar Baviskar
- Digital signal processin1.docxUploaded byRakesh Mohanachandran
- New Microsoft Word Document (3)Uploaded bysugesh98
- Digital Signal Processing (Dsp)Uploaded bywww.bhawesh.com.np
- PDSP ArchitectureUploaded bykrajasekarantuti
- GE 345 RELAY MANUALUploaded byashish saha
- 40713375-peakvueUploaded byLe Thanh Hai
- Dsp Viva QueUploaded bySp Uday
- Lecture DSP IntroductionUploaded byVikramjeet Maitra
- DCT in image processingUploaded byRoshaney Jkd
- Col 10040Uploaded byHossein Davijani
- The How and Why of COFDM -StottUploaded byJoe Caroselli