22799470 Digital Signal Processing Lab Manual

Embed Size (px)

Citation preview

  • 8/11/2019 22799470 Digital Signal Processing Lab Manual

    1/138

    CONTENTS

    PART-A. LIST OF EXPERIMENTS USING MATLAB

    1. Verification of sampling theorem.

    2. Impulse response of a given system.3. Linear convolution of two given sequences.4. Circular convolution of two given sequences.5. utocorrelation of given sequence an! verification of its properties.". Cross correlation of a given sequences an! verification of its properties.#. $olving a given !ifference equation.%. Computation of &'point ()* of a given sequence an! to plot magnitu!e an!

    phase spectrum.+. Linear convolution of two sequences using ()* an! I()*.1,. Circular convolution of two sequences using ()* an! I()*.11. (esign an! implementation of )I- filter to meet given specifications.

    12. (esign an! implementation of II- filter to meet given specifications.

    PART-B. LIST OF EXPERIMENTS USING DSP PROCESSOR.1. Linear convolution of two given sequences.2. Circular convolution of two given sequences.3. Computation of &'point ()* of a given sequence.4. -ealiation of an )I- filter /any type0 to meet given specifications. *he input

    can e a signal from function generatorspeech signal.5. u!io application such as to plot a time an! frequency !isplay of a icrophone

    plus a cosine using ($. -ea! a .wav file an! match with their respective

    spectrograms.". &oise removal !! noise aove 367 an! then remove8 interferencesuppression using 4,,7 tone.

    #. Impulse response of first or!er an! secon! or!er system.

    1

  • 8/11/2019 22799470 Digital Signal Processing Lab Manual

    2/138

    2

  • 8/11/2019 22799470 Digital Signal Processing Lab Manual

    3/138

    EXPERIMENT NO-1

    AIM: VERIFICATION OF SAMPLING THEOREM

    Samplin:Is the process of converting a continuous time signal into a !iscrete timesignal. It is the first step in conversion from analog signal to !igital signal.

    Samplin !"#$%#m:$ampling theorem states that 9:;act reconstruction of a continuoustime ase'an! signal from its samples is possile8 if the signal is an!'limite! an! thesampling frequency is greater than twice the signal an!wi!th8where >is the signal an!wi!th.

    N&'(i)! Ra!# Samplin:*he &yquist rate is the minimum sampling rate require! toavoi! aliasing8 equal to the highest mo!ulating frequency containe! within the signal.In other wor!s8 &yquist rate is equal to two si!e! an!wi!th of the signal /?pper an!

    lower si!ean!s0*o avoi! aliasing8 the sampling rate must e;cee! the &yquist rate. i.e. fs= f&

    P%$%am:@ &yquist -ate $ampling.clcA @ Clear screenfs B 14,,A @ $ampling frequency8 fs B 14,,7t B ,1fs13fsA @ &umer of samples; B cos/2pi4,,t0Dcos/2pi#,,t0A @ Input signal;m B as /fft/;00A @ (etermine the asolute ))* of the input signal!isp/E;mF0A @ (isplays ;m on comman! win!ow!isp /;m0A @ (isplays values of ;m on comman! win!owG B ,length/;m0'1A @ &umer of samples to e plot on ;'a;issuplot /282810A @ (ivi!e the figure win!ow to plot the outputstem /1,,G8 ;m0A @ lot the output;lael /H7H0A @ &ame ;'a;is as 97hen two in!epen!ent signals are compare!8 the proce!ure is Gnownas cross-correlation.

    *he cross correlation function measures the !epen!ence of the value of one signal onanother signal. )or two >$$ />i!e $ense $tationary0 processes ;/t0 an! y/t0 it is!escrie! y8

    r

    >here *is the oservation time.

    )or sample! signals8 cross'correlation is !efine! as8

    )or m B 1 D 2 D O.. D &D1>here&is the recor! length /i.e. numer of samples0.

    E,ampl#:lot the cross correlation for the following signal8

    24

  • 8/11/2019 22799470 Digital Signal Processing Lab Manual

    25/138

    ;/n0 B sin/2Xf1t0 with f 1B 1 7y/n0 B ;/n0 D w/n0

    >here w/n0is a eroes mean8 unit variance of Taussian ran!om process.

    P%$%am:

    clcA @ Clear screen& B 1,24A @ &umer of samplesf1B 1A @ )requency of the sine wave)s B 2,,A @ $ampling frequencyn B , &'1A @ $ample in!e; numers

    ; B sin/2pif1n)s0A @ Input sine wave ;/n0y B ; D 1,ran!n/18 &0A @ !! noise to the input signalt B J1&K/1)s0A @ (efines the length for ;'a;is

    suplot/381810A @ (ivi!e the figure win!ow to plot the resultplot/;0A @ lot the sine wavetitle/Eure sine waveH0A @ *itle as 9ure sine wavee nee!&past values to solve&thor!er !ifference equation.yJ'2K B 1yJ'1K B 2Compute yJnKfor various values of n

    27

  • 8/11/2019 22799470 Digital Signal Processing Lab Manual

    28/138

    yJ,K B 1.5yJ'1K ' yJ'2K D 2;J'2K B 1.52 P 1 D 2,yJ,K B 2

    yJ1K B 1.5yJ,K ' yJ'1K D 2;J'1K B 1.52 ' 2 D 2,yJ1K B 1

    yJ2K B 1.5yJ1K ' yJ,K D 2;J,K B 1.51 P 2 D 21yJ2K B 1.5

    n! so onO

    P%$%am:clcA @ Clear screen; B J, , ones/18 1,0KA @ Input ;JnK B uJnKy\past B J1 2KA @ ast values to solve !ifference equationy/10 B y\past/10A @ yJ1K YB yJ'2Ky/20 B y\past/20A @ yJ2K YB yJ'1Kfor G B 3/length/;0D20 @ Compute yJnK for various values of n y/G0 B 1.5y/G'10 ' y/G'20 D 2;/G'20Aen! @ :n! of for loop

    !isp/E$olution for the given !ifference equationF0A!isp/y0A @ (isplay the result on comman! win!owsuplot/181810A @ (ivi!e the win!ow to plot the resultstem /'2/length/y0'308y0A @ lot the result;lael/EInput ;JnKF0A @ &ame ;'a;is as Input ;JnKylael/Eutput yJnKF0A @ &ame y'a;is as utput yJnKtitle/E(ifference equationF0A @ *itle as 9(ifference equation

    AIM: TO IMPLEMENT CIRCULAR CONVOLUTION OF T2O GIVENSE3UENCES USING DFT AND IDFT

    Ci%0(la% 0$n5$l(!i$n:Let ;1/n0an! ;2/n0are finite !uration sequences oth of length & with ()*Fs U1/G0an!U2/G0.Convolution of two given sequences ;1/n0an! ;2/n0is given y8

    ;3/n0 B I()*JU3/G0K;3/n0 B I()*JU1/G0 U2/G0K

    >here8U1/G0 B ()* J;1/n0KU2/G0 B ()* J;2/n0K

    E,ampl#:

    ;1/n0 B R18 18 28 1S;2/n0 B R18 28 38 4S

    &'1

    U1/G0 B N;1/n0e']2XGn& GB ,8 18 28 O 8 &'1 nB,

    Tiven ;1/n0 B R18 18 28 1S an!&B4

    3

    U1/,0 B N;1/n0 B 1 D 1 D 2 D 1 B 5 nB,

    3

    U1/10 B N;1/n0e']Xn2 B 1 P ] P 2 D ] B '1 nB,

    3U1/20 B N;1/n0e']Xn B 1 P 1 D 2 ' 1 B 1 nB,

    3

    U1/30 B N;1/n0e']3Xn2 B 1 D ] ' 2 ' ] B '1 nB,

    38

  • 8/11/2019 22799470 Digital Signal Processing Lab Manual

    39/138

    U1/G0 B R58 '18 18 '1S

    &ow8

    &'1

    U2/G0 B N;2/n0e']2XGn& GB ,8 18 28 O 8 &'1 nB,

    Tiven;2/n0 B R18 28 38 4S an!&B4

    3

    U2/,0 B N;2/n0 B 1 D 2 D 3 D 4 B 1, nB,

    3U2/10 B N;2/n0 e']Xn2 B 1 D 2/']0 D 3/'10 D 4/]0 B '2 D ]2 nB,

    3

    U2/20 B N;2/n0 e']Xn B 1 D 2/'10 D 3/10 D 4/'10 B '2 nB,

    3

    U2/30 B N;2/n0 e']3Xn2 B 1 D 2/]0 D 3/'10 D 4/']0 B '2 P ]2 nB,

    U2/G0 B R1,8 '2D]28 '28 '2']2S

    >e Gnow that8U3/G0 B U1/G0 U2/G0U3/G0 B R5,8 2 P ]28 '28 2 D ]2S

    Convolution of two given sequences is8;3/n0 B I()*JU3/G0K

    &'1

    ;3/n0 B /1&0 NU3/G0e]2XGn& n B ,8 18 28 O. 8 &'1 GB,

    39

  • 8/11/2019 22799470 Digital Signal Processing Lab Manual

    40/138

    3

    ;3/,0 B /140 NU3/G0 B /140 J5, D 2 ' ]2 P 2 D 2 D ]2K B 13 GB,

    3

    ;3/10 B /140 NU3/G0e]XG2GB,

    ;3/10B /140 J5, D /2 ' ]20 ] D /'20 /'10 D /2 D ]20 /']0K B 14

    3

    ;3/20 B /140 NU3/G0e]XGGB,

    ;3/20 B /140 J5, D /2 ' ]20 /'10 D /'20 /10 D /2 D ]20 /'10K B 11

    3

    ;3/30 B /140 NU3/G0e]3XG2GB,

    ;3/30 B /140 J5, D /2 ' ]20 /']0 D /'20 /'10 D /2 D ]20 /]0K B 12

    Convolute! sequence of two given sequences is8;3/n0 B R138 148 118 12S

    P%$%am:clcA @ Clear screen;1 B input/H:nter 1st sequenceH0A @ Tet the first sequence;2 B input/H:nter 2n! sequenceH0A @ Tet the secon! sequencen B ma;/length/;108 length/;200A @ Tet the ma;imum length of the two sequences;1 B fft/;18n0A @ Compute the ()* of the ;1 using ))* algorithm;2 B fft/;28n0A @ Compute the ()* of the ;2 using ))* algorithmy B ;1.;2A @ ultiply two ()*Fsyc B ifft/y8n0A @ Compute the I()* of mutliplie! sequence to get

    @ the convolute! sequence!isp/HCircular convolution using ()* an! I()*H0A @ (isplays Circular convolution!isp/yc0A @ (isplays the result on comman! win!ow& B ,1n'1A @ (efines the length of ;'a;is to plot the resultsuplot/181810A @ (ivi!e the win!ow to plot the resultstem/&8yc0A @ lots the results;lael/H*imeH0A @ &ame the ;'a;is as 9*ime7/e]w 0 B ,.54J/sin/w&200/sin/w200K D ,.23Jsin /w&2 P X&& P 10sin /w2 P X& '10K

    D ,.23Jsin /w&2 D X&& P 10sin /w2 D X& P 10K

    P%$%am:

    clcA @ Clear screen

    wp B input/Hass an! e!ge freqH0A @ Tet assan! e!ge frequencyws B input/H$top an! e!ge freqH0A @ Tet $topan! e!ge frequencytw B ws'wpA @ $utract W frequency from $W frequency

    & B ceil/"."pitw0D1A @ Compute lengthwn B /hamming/&00A @ -eturns &'point symmetric hamming win!ow in

    @ column vectorW B fir1/&'18wp8wn0A @ (esigns /&'10thor!er lowpass )I- filter an!

    @ returns filter coefficients in length & in vector W!isp/HImpulse response coeffBH0A @ (isplays Impulse response coefficients!isp/W0A @ (isplays the coefficients on comman! win!ow

    J78wK B freq/W81825"0A @ (igital filter frequency response. *his function@ returns the &'point comple; frequency response@ vector 7 an! the &'point frequency vector w in@ ra!ianssample of the filter.

    ag B 2,log1,/as/700A @ Tet the magnitu!eplot/wpipi8 ag0A @ lot the agnitu!e spectrum;lael/E)requency in ra!ians in terms of piH0A@ &ame ;'a;isylael/HTain in !H0A @ &ame y'a;is as 9Tain in !aitY1,,,0RInit>aitDDACW$\write/($6"#13\IC23\(*7&(L:8 ,0A

    104

  • 8/11/2019 22799470 Digital Signal Processing Lab Manual

    105/138

    CW$\write/($6"#13\IC23\(*7&(L:8 ,0ASelseRCW$\write/($6"#13\IC23\(*7&(L:8 !ata0ACW$\write/($6"#13\IC23\(*7&(L:8 !ata0A

    SS

    utput

    4. :nter the source co!e an! save the file with main.c e;tension.

    105

  • 8/11/2019 22799470 Digital Signal Processing Lab Manual

    106/138

    5. -ight clicG on source8 $elect a!! files to pro]ect an! Choose main.c file $ave! efore.

    ". !! the other supporting .c files which configure the au!io co!ec.

    106

  • 8/11/2019 22799470 Digital Signal Processing Lab Manual

    107/138

    #. #. a0 To to ro]ect to Compile. 0 To to ro]ect to Wuil!. c0 To to ro]ect to -euil! ll.

    107

  • 8/11/2019 22799470 Digital Signal Processing Lab Manual

    108/138

    %. To to file an! loa! program an! loa! .$(!file into the oar!.

    +. To to (eug an! clicG on run to run the program.

    108

    It will showswarnings an!errors if any

  • 8/11/2019 22799470 Digital Signal Processing Lab Manual

    109/138

    109

  • 8/11/2019 22799470 Digital Signal Processing Lab Manual

    110/138

    1,. *o see the Traph go to View an! select timefrequency in the Traph an! give thecorrect $tart a!!ress provi!e! in the program8 (isplay !ata can e taGen as per user.

    110

  • 8/11/2019 22799470 Digital Signal Processing Lab Manual

    111/138

    11. Treen line is to choose the point8 Value at the point can e seen /7ighlighte! y circleat the left corner0.

    12. In the graph8 chose ))* magnitu!e as !isplay type we will get Traph W

    111

  • 8/11/2019 22799470 Digital Signal Processing Lab Manual

    112/138

    Traph 2))* magnitu!e of )I- filter.

    13. *he impulse response of )I- filters.

    112

  • 8/11/2019 22799470 Digital Signal Processing Lab Manual

    113/138

    113

  • 8/11/2019 22799470 Digital Signal Processing Lab Manual

    114/138

    E,p#%im#n! 8: N$i)# R#m$5alP%$0#/(%# !$ 0%#a!# n#7 P%$?#0!:

    1. *o create pro]ect8 To to ro]ect an! $elect &ew.

    2. Tive pro]ect name an! clicG on finish.

    114

  • 8/11/2019 22799470 Digital Signal Processing Lab Manual

    115/138

    / N$!#:Location must e cCC$tu!io\v3.1yro]ects 0.3. ClicG on )ile &ew $ource )ile8 *o write the $ource Co!e.

    115

  • 8/11/2019 22799470 Digital Signal Processing Lab Manual

    116/138

    AIM:&oise removal in a given mi;e! signal.N$i)# %#m$5al:In the real time systems every signal will get corrupte! y the noise. *oanalye the noise we nee! to a!! the noise8 a noise will e generate! an! a!!e! to thesignal. noise of 367 is a!!e! to a tone of 4,,67 then the noise is remove! y usingan high pass filter.

    P%$%am:

    jinclu!e Yst!io.h=jinclu!e kc"#13!sG.hkjinclu!e kmaster.hkjinclu!e kaic23cfg.hkjinclu!e k!sG"#13\aic23.hkjinclu!e Yst!.h=jinclu!e Yswi.h=jinclu!e Ylog.h=jinclu!e Yc";.h=

    jinclu!e Ycsl.h=jinclu!e Ycsl\mcsp.h=

    j!efine )iltLen 4#

    j!efine $I&:\*WL:\$I: 4%

    float filter\CoeffJ32K BR,.,,8,.,,8,.,,8,.,,8,.,,8,.,,8,.,,8,.,,8,.,,8,.,,8,.,,8,.,,8,.,,8,.,,8,.,,8,.,,8,.,,8,.,,8,.,,8,.,,8,.,,8,.,,8,.,,8,.,,8,.,,8,.,,8,.,,8,.,,8,.,,8,.,,81.,,8,.,,SA

    float r&oiseJ",,KBR,.35,+8,.111%8,.3"318,.2"#38,.2%2"8,.1+,+8,.2+,18,.13#%8,.12#,8 ,.1#+%8,.2+258,.3#3,8,.13,#8,.13%,8,.2%5+8,.1#3%8,.32#%8,.,3558,.31##8,.2+,58 ,.14#38,.23%,8,.21128,.2""28,.322%8,.,2"48,.2++18,.3,2#8,.122,8,.1"#"8 ,.23",8,.2+428,.3,5%8,.3,138,.14238,.14#%8,.34#+8,.2,1#8,.32#%8,.11"48 ,.2#4#8,.2#528,.423+8,.,"""8,.213,8,.21248,.,1248,.33,"8,.31348,.142,8 ,.2%3#8,.,44"8,.243%8,.1,"+8,.1+,28,.34+#8,.,+"28,.14,48,.2,4"8,.141+8 ,.32318,.3+"28,.,54+8,.,%#58,.2#428,.141%8,.3#+#8,.3#5"8,.24418,.32#18 ,.145"8,.23328,.3#%+8,.225,8,.3#+%8,.31538,.22+58,.2+5,8,.3+248,.,+%28 ,.14+38,.3"4+8,.115+8,.2,+58,.3,%%8,.3"5"8,.253+8,.,","8,.,54%8,.2%4#8 ,.2"1,8,.4,,58,.2+%58,.245+8,.1#%+8,.,%248,.3##48,.225"8,.,3,+8,.2+4+8 ,.21338,.,13"8,.32%%8,.,+238,.,4+18,.,1#%8,.12,58,.11,#8,.3,428,.,#"18 ,.15128,.13,28,.34348,.13%48,.24548,.1%#38,.2%,48,.,4,#8,.41"48,.3%5%8 ,.,"#%8,.22#58,.143,8,.23,48,.,5,,8,.1#+38,.1%%#8,.2,"#8,.1##"8,.,3#48 ,.244+8,.2,+38,.,##28,.1+%28,.1#%#8,.2,218,.2+1"8,.255#8,.33,48,.,1%48 ,.,%+28,.1%238,.3#"28,.2+%48,.15#"8,.112,8,.,,%%8,.3,2"8,.22#48,.12238 ,.21518,.11318,.324%8,.14418,.34#58',.,4#18,.2#4+8,.1+258,.1#,%8,.24318 ,.2+#58,.,"348,.3%+18,.,3#28,.14%"8,.,+438,.3%358,.,3558,.232,8,.24""8

    116

  • 8/11/2019 22799470 Digital Signal Processing Lab Manual

    117/138

    ,.242%8,.31#58',.,1,58,.2%+18,.1#"48,.2"218,.,%148,.223+8,.3,#48,.41+"8 ,.2,"58,.,"138,.,3218,.24+58,.3,448,.25138,.11+38,.3"358,.2,318,.3%,18 ,.,3,38,.,#338,.3,,18,.35,#8,.2+%58,.11%"8,.,"5"8,.3"128,.33+#8,.12+48 ,.11,28,.11+48,.3,258,.2%+28,.1%458,.1+5"8,.1,#38,.2+%18,.3"%28,.23118 ,.22448,.2,++8,.,++,8,.222,8,.2%+48,.2%138,.231"8,.,"538,.2%#28,.1,4%8

    ,.13358,.1"3+8,.13358,.2#528,.,2"28,.2+5%8,.222"8,.2+1"8,.11428,.2,1#8 ,.32528,.2,+38,.12%,8,.43358,.,"2#8,.1%5,8,.43%%8,.1%218,.14518,.,5448 ,.34"28,.,1548,.,%228,.3,318,.14#%8,.213,8,.223,8,.2%+#8,.,3+#8,.243"8 ,.,42%8,.35518,.145%8,.33%28,.,+5#8,.23,38,.3%,48,.,2"28,.,35"8,.,13,8 ,.2",#8,.21,28',.,,2,8,.25%18,.1+338',.,,4#8,.,2448,.,+228,.3%,58,.1,+28 ,.1"#,8,.144#8,.,4##8,.3,##8,.21248,.21248,.1%#+8,.1"238,.121+8,.2+,48 ,.,+538,.11328,.,5,28,.4,,28,.3#"58,.,,+"8,.144,8,.22+18,.1,2#8,.31148 ,.25%,8,.2,%+8,.14348,.31"%8,.35,38,.25518,.1,"48,.312#8,.,5%%8,.1+2"8 ,.3%"#8,.141%8,.153%8,.42418,.,"5+8,.143%8,.22%"8,.,5,%8,.2,#28,.2#4,8 ,.1"%%8,.241"8,.,%2#8,.23148,.34+"8,.1+348,.3%%"8,.,%+48,.,#,48,.14+38 ,.1%438,.1%5+8,.12528,.255+8,.,,358,.121#8,.,#1#8,.,+128,.,2518,.24,58

    ,.143"8,.1,#48,.,4+38,.15528,.245"8,.35"58',.,1"#8,.3,258',.,1%#8,.2##28 ,.2%1"8,.35%28,.,#5,8,.24228,.21"+8,.121,8,.2"348,.24248,.,",,8,.1"318 ,.32+38,.13%38,.23#18,.15518,.,33%8,.15+38,.3#2,8,.1%128,.,",#8,.1+++8 ,.12,"8,.24118,.1"358,.2#2#8,.2+5%8,.,#5%8,.,#,18,.35"58,.2%%,8,.,3"38 ,.3#2"8,.2,,28,.2,,38,.212#8,.2#"%8,.314"8,.14,,8,.,2+18,.2+3"8,.13418 ,.33#58,.15448,.33218,.,#1"8,.,5328,.34#38,.,1#"8,.2"#18,.2##28,.1"1#8 ,.12"48,.3"%%8,.14#58,.1#"%8,.,#"48,.155"8,.153+8,.3"%48,.,+#+8,.1,128 ,.12"18,.24,18,.,1538,.32348,.,3#38,.2,528,.,4"58,.34,58,.3,5"8,.,+,18 ,.25%58,.1#4"8,.2+,58,.1#+58,.33""8,.1#448,.1"1%8,.23#28,.14218,.3+3#8 ,.1+2#8,.,#",8,.124%8,.23"#8,.115+8,.,4318,.335,8,.24528,.1%,,8,.12348

    ,.11338,.21"48,.1#428,.2#%38,.,,538,.31%,8,.251%8,.,3%"8,.32#,8,.,",+8 ,.22#38,.2,",8,.,4##8,.,,2+8,.31%28,.321%8,.1+%,8,.,4%38,.25328,.,#,48 ,.2"%%8,.1%,58,.,"348,.33,48,.2%1"8,.34#,8,.,3+"8,.,%228,.3,##8,.2%128 ,.2+,"8,.1"5+8,.14""8,.22#%8,.35",8,.3,+58,.2"#18,.1#+%8,.333+8,.1"128 ,.1+"#8,.2#558,.22258,.24%38,.3,138,.2+418,.,2,18,.,%,#8,.13+58,.21148 ,.,+118,.213#8,.113,8,.14358,.2%1#8,.,31,8,.,"#%8,.31,#8,.142+8,.,%148 ,.242+8,.3#128,.15%#8,.2"228,.21"+8,.15,38,.1%348,.3%+#8,.,%4"8,.1#,38 ,.23418,.2"318,.34128,.13448,.,+,38,.1++38,.,+3+8,.2%4#8,.1"+#8,.23128 ,.2#"18,.1#538,.11+,8,.,%"%8,.3%"48,.,%138,.3,238,.21458,.2#"48,.314%8 ,.,,%"8,.132+8,.3+528,.2"%48,.3%438,.21%18,.,22"8,.2"%18,.1,%,8,.224+8 ,.2%328,.23+58,.21+38,.15+,8,.,""38,.14#48',.,1"38,.22",8,.3#2#8,.,3,38 ,.,2358,.3"2#8,.1,"28,.,,%48,.324"8,.,5"%8,.34%58,.,4,#8,.13538,.233%8 ,.23158,.25458,.24%28,.151,8,.,3"38,.2%%28,.,+258,.2",38,.34448,.,4458 ,.4,348,.,1"28,.331+8,.32128,.,,""8,.2,1,8,.3",48,.112,8,.31558,.23+,8 ,.32318,.33,18,.,2"+8,.113%8,.252,8,.1%#58,.3##%8,.2+3+8,.21338,.11#,8 ,.,+##8,.35248,.1""48,.32118,.,2528,.33"18,.,,238,.35138,.3"%"8,.21518 ,.,5%18,.,###8,.1""48,.32118,.,2528,.33"18,.,,238,.35138,.3"%"8,.2151SA

    float -em&oiseJ4#KBR '2.1%1,3,"2+,"2+,%e',,28%.+1#42%2115"425"e',,381.1%2%"313,+"3+4#e',,281.42%4533#5#4%1,"e',,281.4,335,%14552515e',,28

    117

  • 8/11/2019 22799470 Digital Signal Processing Lab Manual

    118/138

    1.,3+%5","#"4+,"#e',,28 5.,+32#42,,2#5%2#e',,381.4215%12"231%%43e',,382.51543,+3"5##3"%e',,38+.3"3,5321311112"e',,381.+4+15211244""23e',,282.#22%+#"+%"%4+#2e',,282.5#++4323##,,51#e',,281.,5,"451+1333"#5e',,28'1.%321"3++%",43+#e',,28'5.4,"1+41%1,33"4,e',,28'%.514%"+#235%4"1"e',,28'+.%%#"1%###1+4#"4e',,28'%."33153232%2,#5%e',,28'4."51515,2451#2"1e',,28

    1.21#,11"1,"2+542e',,28#.3+4%3%432,%%444e',,281.2,"%,2"1"4,+422e',,181.3%,"243###2+,+4e',,181.2,"%,2"1"4,+422e',,18#.3+4%3%432,%%444e',,281.21#,11"1,"2+542e',,28'4."51515,2451#2"1e',,28'%."33153232%2,#5%e',,28'+.%%#"1%###1+4#"4e',,28'%.514%"+#235%4"1"e',,28'5.4,"1+41%1,33"4,e',,28'1.%321"3++%",43+#e',,281.,5,"451+1333"#5e',,282.5#++4323##,,51#e',,282.#22%+#"+%"%4+#2e',,281.+4+15211244""23e',,28+.3"3,5321311112"e',,382.51543,+3"5##3"%e',,381.4215%12"231%%43e',,385.,+32#42,,2#5%2#e',,381.,3+%5","#"4+,"#e',,281.4,335,%14552515e',,281.42%4533#5#4%1,"e',,281.1%2%"313,+"3+4#e',,28%.+1#42%2115"425"e',,38'2.1%1,3,"2+,"2+,%e',,2SA

    int sinetaleJ$I&:\*WL:\$I:K B R,;,,,,,,,,8 ,;,,,,1,48 ,;,,,,212,8,;,,,,3,f8 ,;,,,,3fff8 ,;,,,,4!ea8 ,;,,,,5a%18 ,;,,,,"5%8 ,;,,,,"e!%8,;,,,,#"3f8 ,;,,,,#a18 ,;,,,,#ee58 ,;,,,,#ff!8 ,;,,,,#ee58 ,;,,,,#a18,;,,,,#"ef8 ,;,,,,"e!%8 ,;,,,,"5%8 ,;,,,,5a%18 ,;,,,,4!ea8 ,;,,,,3fff8,;,,,,3,f8 ,;,,,,212,8 ,;,,,,1,48,;,,,,,,,,8 ,;ffffef4c8 ,;ffff!ee,8 ,;ffffcf,"8,;ffffc,,28 ,;ffff21"8 ,;ffffa5#f8 ,;ffff+a#58,;ffff+12%8 ,;ffff%+c18 ,;ffff%45f8,;ffff%118 ,;ffff%,,28 ,;ffff%118 ,;ffff%45f8 ,;ffff%+c18,;ffff+12%8 ,;ffff+a#"8,;ffffa5#f8 ,;ffff21"8 ,;ffffc,,28 ,;ffffcf,"8 ,;ffff!ee,8 ,;ffffef4cSA

    ($6"#13\IC23\Config config B R ,;,,1#8 , ($6"#13\IC23\L:)*I&VL Left line input channel volume ,;,,1#8 1 ($6"#13\IC23\-IT7*I&VL -ight line input channel volume ,;,,!%8 2 ($6"#13\IC23\L:)*7VL Left channel hea!phone volume

    ,;,,!%8 3 ($6"#13\IC23\-IT7*7VL -ight channel hea!phone volume ,;,,118 4 ($6"#13\IC23\&*7 nalog au!io path control

    ,;,,,,8 5 ($6"#13\IC23\(IT*7 (igital au!io path control ,;,,,,8 " ($6"#13\IC23\>:-(>& ower !own control ,;,,438 # ($6"#13\IC23\(ITI) (igital au!io interface format ,;,,%c8 % ($6"#13\IC23\$L:-*: $ample rate control ,;,,,1 + ($6"#13\IC23\(ITC* (igital interface activation

    SA

    ($6"#13\IC23\Co!ec7an!le hCo!ecAInt32 Init>ait B1AInt32 !ataA

    float in\ufferJ1,,KAfloat In$igWufferJ",,KAfloat &oiseWufferJ",,KAfloat Corr$igWufferJ",,KA

    118

  • 8/11/2019 22799470 Digital Signal Processing Lab Manual

    119/138

    float -ecov$igWufferJ",,KAint LogIn!e; B,A

    main/0Rint iA

    L:(B,;,Afor/ i B , A i Y 1,,A iDD 0 in\ufferJiKB,.,AhCo!ec B ($6"#13\IC23\openCo!ec/,8 config0AI-\gloal:nale/0AI-\enale/I-\:V*\-I&*10AI-\enale/I-\:V*\UI&*10A

    S

    voi! le!/0Rstatic int cc B 1AL:( B ccA

    if /cc BB ,;,30 cc B ,;,5Aelse if /cc BB ,;,50 cc B ,;,"Aelse if /cc BB ,;,"0 cc B ,;,3Aelse cc B ,;,3A

    S

    setpll2,,/0RS

    voi! rea!/0Rint i B ,Afloat resultAfloat In(ataAfloat In&oiseAfloat InCorrupAstatic int &oiseIn!e;B,Astatic int $inIn!e; B ,A!ataBCW$\rea!/($6"#13\IC23\(*7&(L:0Aif/!ata=B32#"%0 !ataB !ata,;ffff,,,,A

    Comment from hereIn(ata B /float0 /sinetaleJ$inIn!e;K01"A$inIn!e; DB 4Aif /$inIn!e; =B 4%0

    $inIn!e; @B4%A Comment till here

    In&oise B r&oiseJ&oiseIn!e;DDK4,+" ' 1,24Aif /&oiseIn!e; BB ",,0

    &oiseIn!e; B ,A

    119

  • 8/11/2019 22799470 Digital Signal Processing Lab Manual

    120/138

    InCorrup B In(ata D In&oiseAfor/ i B ,A i YB /)iltLen'20A iDD0 in\ufferJiK B in\ufferJiD1KAin\ufferJ)iltLen'1KBInCorrupAresult B ,Afor/ i B , A i YB /)iltLen'10A iDD 0 result DB -em&oiseJiK in\ufferJiKA

    !ata B /Int320/result5120A )or (emoIn$igWufferJLogIn!e;KB In(ataA&oiseWufferJLogIn!e;KB In&oise ACorr$igWufferJLogIn!e;KB InCorrupA-ecov$igWufferJLogIn!e;K B /float0!ataALogIn!e;DDAif /LogIn!e; BB ",,0LogIn!e; B,A

    Svoi! write/0R

    if /Init>aitY1,,,0RInit>aitDDA

    CW$\write/($6"#13\IC23\(*7&(L:8 ,0ACW$\write/($6"#13\IC23\(*7&(L:8 ,0A

    SelseR CW$\write/($6"#13\IC23\(*7&(L:8 !ata0A

    CW$\write/($6"#13\IC23\(*7&(L:8 !ata0AS

    S

    utput

    120

  • 8/11/2019 22799470 Digital Signal Processing Lab Manual

    121/138

    4. :nter the source co!e an! save the file with main.c e;tension.

    5. -ight clicG on source8 $elect a!! files to pro]ect an! Choose main.c file $ave! efore.

    121

  • 8/11/2019 22799470 Digital Signal Processing Lab Manual

    122/138

    ". !! the other supporting .c files which configure the au!io co!ec.

    #. #. a0 To to ro]ect to Compile. 0 To to ro]ect to Wuil!. c0 To to ro]ect to -euil! ll.

    122

  • 8/11/2019 22799470 Digital Signal Processing Lab Manual

    123/138

    %. To to file an! loa! program an! loa! .$(!file into the oar!.

    123

    It will showswarnings an!

    errors if any

  • 8/11/2019 22799470 Digital Signal Processing Lab Manual

    124/138

  • 8/11/2019 22799470 Digital Signal Processing Lab Manual

    125/138

    1,. *o see the Traph go to View an! select timefrequency in the Traph an! give thecorrect $tart a!!ress provi!e! in the program8 (isplay !ata can e taGen as per user.

    11. Treen line is to choose the point8 Value at the point can e seen /7ighlighte! y circleat the left corner0.

    125

  • 8/11/2019 22799470 Digital Signal Processing Lab Manual

    126/138

    E,p#%im#n! 9: Imp(l)# R#)p$n)#P%$0#/(%# !$ 0%#a!# n#7 P%$?#0!:

    1. *o create pro]ect8 To to ro]ect an! $elect &ew.

    2. Tive pro]ect name an! clicG on finish.

    / N$!#:Location must e cCC$tu!io\v3.1yro]ects 0.

    126

  • 8/11/2019 22799470 Digital Signal Processing Lab Manual

    127/138

    3. ClicG on )ile &ew $ource )ile8 *o write the $ource Co!e.

    AIM:*o fin! Impulse response of a first or!er an! secon! or!er system.

    127

  • 8/11/2019 22799470 Digital Signal Processing Lab Manual

    128/138

    !iscrete time system performs an operation on an input signal ase! on pre!efine!criteria to pro!uce a mo!ifie! output signal. *he input signal ;/n0is the systeme;citation8 an! y/n0is the system response. *he transform operation is shown as8

    ;/n0 y/n0 B *J/;/n0K

    *he convolution sum can e represente! y8 y/n0 B ;/n0 h/n0

    F$% E,ampl# l#!) in/ $(! an imp(l)# %#)p$n)# $ a /i#%#n0# #'(a!i$n.

    *he general form of !ifference equation is8

    y/n0 B NaGy/n'G0 D NG;/n'G0GB1 GB,

    Find out the impulse response of second order difference

    equation.

    P%$%am:

    jinclu!eYst!io.h=j!efine r!er 2j!efine Len 5float hJLenK B R,.,8,.,8,.,8,.,8,.,S8sumAvoi! main/0Rint ]8 GAfloat aJr!erD1K B R,.13118 ,.2"228 ,.1311SAfloat Jr!erD1K B R18 ',.#4#%8 ,.2#22SA

    for/]B,A ]YLenA ]DD0Rsum B ,.,Afor/GB1A GYBr!erA GDD0R

    if //]'G0 =B ,0sum B sumD/JGKhJ]'GK0ASif /] YB r!er0hJ]K B aJ]K'sumAelsehJ]K B 'sumAprintf /k @f k8hJ]K0A

    128

    *

  • 8/11/2019 22799470 Digital Signal Processing Lab Manual

    129/138

    SS

    O(!p(!:

    ,.1311,, ,.3",23# ,.3"4#++ ,.1#4#41 ,.,313#3

    For first order difference equation.

    P%$%am:jinclu!eYst!io.h=j!efine r!er 1j!efine Len 5float hJLenK B R,.,8,.,8,.,8,.,8,.,S8sumA

    voi! main/0Rint ]8 GA

    float aJr!erD1K B R,.13118 ,.2"22SAfloat Jr!erD1K B R18 ',.#4#%SAfor/]B,A ]YLenA ]DD0Rsum B ,.,Afor/GB1A GYBr!erA GDD0Rif//]'G0=B,0sum B sumD/JGKhJ]'GK0ASif/]YBr!er0

    hJ]K B aJ]K'sumAelsehJ]K B 'sumAprintf/k@f k8 ]8 hJ]K0ASS

    O(!p(!:,.1311,, ,.3",23# ,.2"+3%5 ,.2,144" ,.15,"41

    4. :nter the source co!e an! save the file with 9.Ce;tension.

    129

  • 8/11/2019 22799470 Digital Signal Processing Lab Manual

    130/138

    5. -ight clicG on source8 $elect a!! files to pro]ect .. an! Choose 9.C 9 file $ave! efore.

    130

  • 8/11/2019 22799470 Digital Signal Processing Lab Manual

    131/138

    ". -ight ClicG on liraries an! select a!! files to ro]ect.. an! chooseCCC$tu!io\v3.1C",,,cgtoolslirts"#,,.li an! clicG open.

    131

  • 8/11/2019 22799470 Digital Signal Processing Lab Manual

    132/138

    #. a0 To to ro]ect to Compile. 0 To to ro]ect to Wuil!.

    132

  • 8/11/2019 22799470 Digital Signal Processing Lab Manual

    133/138

  • 8/11/2019 22799470 Digital Signal Processing Lab Manual

    134/138

    +. To to (eug an! clicG on run to run the program.

    134

  • 8/11/2019 22799470 Digital Signal Processing Lab Manual

    135/138

    1,. serve the output in output win!ow.

    135

  • 8/11/2019 22799470 Digital Signal Processing Lab Manual

    136/138

    136

    utput will!isplayhere

  • 8/11/2019 22799470 Digital Signal Processing Lab Manual

    137/138

    11. *o see the Traph go to View an! select timefrequency in the Traph8 an! give thecorrect $tart a!!ress or the output variale name provi!e! in the program8 (isplay !atacan e taGen as per user. $elect ($ !ata type as 32'it floating point.

    137

  • 8/11/2019 22799470 Digital Signal Processing Lab Manual

    138/138

    12. Treen line is to choose the point8 Value at the point can e seen /7ighlighte! y circleat the left corner0.

    138