Está en la página 1de 5

Tema:Correlacin

1. Cmosepodracalcularlacorrelacinmediantelaconvolucin?
2. Calcular la correlacin de los ejemplos vistos en clase, mediante la convolucin (puede
utilizarelcomandoconvdematlab.
3. Calcularlacorrelacindelosejemplosvistosenclase,medianteelmtododematriz(debe
plantearlaformaenquesedefiniradichamatriz.
4. Calcule la correlacin normalizada (Ecs. 2.6.17 y 2.6.28, pgina 123 libro Digital Signal
Processing,JohnG.Proakis)delosejemplosvistosenclaseydetarea(sepuedeapoyaren
matlab)
5. Calcule con el mtodo matricial el ejemplo 2.6.1 pgina 121 del libro Digital Signal
Processing,JohnG.Proakis.Tambincalculelacorrelacinnormalizada,Ecs.2.6.17y2.6.28,
pgina123libroDigitalSignalProcessing,JohnG.Proakis.
6. Investigarelusodelacorrelacinparalaeliminacinderuidodeunaseal

27/ 09/ 14 09: 48 AM C: \ User s\ mj uar ezh\ Document s\ M. . . \ demo1. m 1 of 3


%A demonst r at i on of cr oss cor r el at i on i n act i on.
%Hi t t he space bar dur i ng t he demo t o execut e
%
%ht t p: / / dador r an. wor dpr ess. com/ 2014/ 04/ 25/ cr oss- cor r el at i on- demo/
cl c; cl ose al l
%a = [ 0. 1 0. 2 - 0. 1 4. 1 - 2 1. 5 0 ] ;
%b = [ 0. 1 4 - 2. 2 1. 6 0. 1 0. 1 0. 2] ;

cl ear al l
F=10;

t =0: 1/ F: ( 1/ 1) *1
%t =0: 1: 11;
a=si n( 2*pi *1*t )
b = l agmat r i x( a, 0) ;
b( i snan( b) ) = 0
b=b' ;

l en = l engt h( a) ;
i f ( l en ~= l engt h( b) )
er r or ( ' vect or s suppl i ed must be t he same l engt h' ) ;
end
f i gur e
set ( gcf , ' posi t i on' , [ 285 347 642 367] ) ;

max_amp = max( [ max( a) max( b) ] ) ;
mi n_amp = mi n( [ mi n( a) mi n( b) ] ) ;


pl ot _h = 0. 25;
t ext _h = 0. 1;
ax1 = subpl ot ( 2, 1, 1) ;
pl 1_l i ne = pl ot ( a) ;
l abel s1 = t ext ( [ 1: l en] , a , num2st r ( a' ) , ' Ver t i cal Al i gnment ' , ' bot t om' , . . .
' Hor i zont al Al i gnment ' , ' r i ght ' , ' f ont si ze' , 8) ;
hol d on; pl 1_dot = pl ot ( a, ' r . ' ) ;
xl i m( [ 1 l en] )
yl i m( [ mi n_amp max_amp] )

set ( ax1, ' posi t i on' , [ ( 1/ 3) 0. 95- pl ot _h ( 1/ 3) pl ot _h] )
set ( ax1, ' vi si bl e' , ' of f ' )

ax2 = subpl ot ( 2, 1, 2) ;
pl 2_l i ne = pl ot ( b) ;
l abel s2 = t ext ( [ 1: l en] , b , num2st r ( b' ) , ' Ver t i cal Al i gnment ' , ' bot t om' , . . .
' Hor i zont al Al i gnment ' , ' r i ght ' , ' f ont si ze' , 7) ;
hol d on; pl 2_dot = pl ot ( b, ' r . ' ) ;
xl i m( [ 1 l en] )
yl i m( [ mi n_amp max_amp] )
set ( ax2, ' vi si bl e' , ' of f ' )
set ( ax2, ' posi t i on' , [ ( 1/ 3) 0. 9- pl ot _h*2 ( 1/ 3) pl ot _h] )
27/ 09/ 14 09: 48 AM C: \ User s\ mj uar ezh\ Document s\ M. . . \ demo1. m 2 of 3


st r = ' ' ;
f or k = 1: l en
st r = [ st r ' ( ' num2st r ( a( k) ) ' ) ( ' num2st r ( b( k) ) ' ) + ' ] ;
end
st r ( end- 1) = ' =' ;
st r = [ st r num2st r ( sum( a. *b) ) ] ;
r _ba = xcor r ( a, b) ;

cor r _cal c_t ext = annot at i on( ' t ext box' , [ 0 0. 85- pl ot _h*2- t ext _h 1 t ext _h] ,
' l i nest yl e' , ' none' , ' hor i zont al al i gnment ' , ' cent er ' , ' st r i ng' , {' cor r el at i on at zer o l ag i s
' st r }, ' f ont si ze' , 8) ;

annot at i on( ' t ext box' , [ 0. 5 0. 8- pl ot _h*2- t ext _h*2 1 t ext _h] ,
' l i nest yl e' , ' none' , ' hor i zont al al i gnment ' , ' l ef t ' , ' st r i ng' , spr i nt f ( ' %. 2f ' , r _ba
( l en) ) , ' col or ' , ' r ed' , ' f ont si ze' , 8) ;


pause

x_i nc= ( 1/ 3) / ( l en- 1) ;
f or k = 1: l en- 1

st r = ' ' ;
f or m= 1: l en- k
st r = [ st r ' ( ' num2st r ( a( m+k) ) ' ) ( ' num2st r ( b( m) ) ' ) + ' ] ;
end
st r ( end- 1) = ' =' ;
st r = [ st r num2st r ( r _ba( l en+k) ) ] ;

set ( cor r _cal c_t ext , ' st r i ng' , {[ ' cor r el at i on at l ag of ' num2st r ( k) ' i s ' ] st r },
' f ont si ze' , 8) ;

set ( ax2, ' posi t i on' , [ ( 1/ 3) +k*x_i nc 0. 9- pl ot _h*2 ( 1/ 3) pl ot _h] )

annot at i on( ' t ext box' , [ 0. 5+x_i nc*k 0. 8- pl ot _h*2- t ext _h*2 1 t ext _h] ,
' l i nest yl e' , ' none' , ' hor i zont al al i gnment ' , ' l ef t ' , ' st r i ng' , spr i nt f ( ' %. 2f ' , r _ba
( l en+k) ) , ' col or ' , ' r ed' , ' f ont si ze' , 8) ;
i f ( k ==1)
pause
annot at i on( ' t ext box' , [ 0. 5 0. 01 1 t ext _h] ,
' l i nest yl e' , ' none' , ' hor i zont al al i gnment ' , ' l ef t ' , ' st r i ng' , [ ' 0' ] , ' col or ' , ' bl ue' ,
' f ont si ze' , 8) ;
annot at i on( ' t ext box' , [ 0. 001 0. 01 1 t ext _h] ,
' l i nest yl e' , ' none' , ' hor i zont al al i gnment ' , ' l ef t ' , ' st r i ng' , [ ' Lag: ' ] , ' col or ' , ' bl ue' ) ;
annot at i on( ' t ext box' , [ 0. 5+x_i nc*( l en) 0. 8- pl ot _h*2- t ext _h*2 1 t ext _h] ,
' l i nest yl e' , ' none' , ' hor i zont al al i gnment ' , ' l ef t ' , ' st r i ng' , ' ] ' , ' col or ' , ' r ed' ) ;
annot at i on( ' t ext box' , [ 0. 5- x_i nc*( l en- 1) - x_i nc/ 2 0. 8- pl ot _h*2- t ext _h*2 1
t ext _h] , ' l i nest yl e' , ' none' , ' hor i zont al al i gnment ' , ' l ef t ' , ' st r i ng' , ' [ ' , ' col or ' , ' r ed' ) ;
annot at i on( ' t ext box' , [ 0. 001 0. 8- pl ot _h*2- t ext _h*2 1 t ext _h] ,
27/ 09/ 14 09: 48 AM C: \ User s\ mj uar ezh\ Document s\ M. . . \ demo1. m 3 of 3
' l i nest yl e' , ' none' , ' ver t i cal al i gnment ' , ' mi ddl e' , ' hor i zont al al i gnment ' , ' l ef t ' , ' st r i ng' ,
{' Cor r el at i on' ' Sequence: ' } , ' col or ' , ' r ed' ) ;

end
annot at i on( ' t ext box' , [ 0. 5+x_i nc*k 0. 01 1 t ext _h] ,
' l i nest yl e' , ' none' , ' hor i zont al al i gnment ' , ' l ef t ' , ' st r i ng' , [ ' ' num2st r ( k) ]
, ' col or ' , ' bl ue' , ' f ont si ze' , 8) ;

pause
end

f or k = 1: l en- 1

st r = ' ' ;
f or m= 1: l en- k
st r = [ st r ' ( ' num2st r ( a( m) ) ' ) ( ' num2st r ( b( m+k) ) ' ) + ' ] ;
end
st r ( end- 1) = ' =' ;
st r = [ st r num2st r ( r _ba( l en- k) ) ] ;

set ( cor r _cal c_t ext , ' st r i ng' , {[ ' cor r el at i on at l ag of ' num2st r ( - 1*k) ' i s ' ] st r },
' f ont si ze' , 8) ;

set ( ax2, ' posi t i on' , [ ( 1/ 3) - k*x_i nc 0. 9- pl ot _h*2 ( 1/ 3) pl ot _h] )
annot at i on( ' t ext box' , [ 0. 5- x_i nc*k 0. 8- pl ot _h*2- t ext _h*2 1 t ext _h] ,
' l i nest yl e' , ' none' , ' hor i zont al al i gnment ' , ' l ef t ' , ' st r i ng' , spr i nt f ( ' %. 2f ' , r _ba( l en-
k) ) , ' col or ' , ' r ed' , ' f ont si ze' , 8) ;
annot at i on( ' t ext box' , [ 0. 5- x_i nc*k 0. 01 1 t ext _h] ,
' l i nest yl e' , ' none' , ' hor i zont al al i gnment ' , ' l ef t ' , ' st r i ng' , [ ' ' num2st r ( k*- 1) ]
, ' col or ' , ' bl ue' , ' f ont si ze' , 8) ;

pause
end

%Uncomment t he next t wo l i nes i f you woul d l i ke t o see a pl ot of t he
%cor r el at i on sequence
%[ cor r _seq l ags] = xcor r ( a, b) ;
%pl ot ( l ags, cor r _seq)
%xl abel ( ' l ags' ) ; yl abel ( ' cor r el at i on measur e' ) ;

También podría gustarte