matlab - Calculating the corelation of 2D signals with different sizes -
i trying calculate correlation between 2 different signals , works perfect if signals have same size. gives error if there size different. wondering if there way can change size of 1 other can have same size? help??
as example:
if signal 1 matrix of size 130x9
, signal 2
matrix of size 122x12
, same .. need scale 1 of them other, both of them can of size 130x9
or 122x12
.
my code:
norm_xcorr_mag = @(x,y)(max(abs(xcorr(x,y)))/(norm(x,2)*norm(y,2))); norm_xcorr_mag(signal1,signal2);
if have signal processing toolbox
,
a = randi(100,[130 9]); b = randi(100,[122 12]); maxrow = max(size(a,1),size(b,1)); maxcol = max(size(a,2),size(b,2)); newa = resample(a,maxrow,size(a,1)); newb = resample(b,maxrow,size(b,1)); newa = resample(newa',maxcol,size(a,2))'; newb = resample(newb',maxcol,size(b,2))';
newa
, newb
both 130x12
you try intrep1
.
Comments
Post a Comment