From: Stefanie on 16 Feb 2010 11:24 Thanks for the help. I think I found the problem. I had -Inf and Inf values in my data vectors which seemed to confuse the corr2 function. I changed that and now its working. "Oleg Komarov" <oleg.komarovRemove.this(a)hotmail.it> wrote in message <hlec36$5or$1(a)fred.mathworks.com>... > "Stefanie " <steffi_rulla(a)hotmail.com> wrote in message <hlebbg$g6h$1(a)fred.mathworks.com>... > > Hi there, > > I'm trying to correlate 2 signals with the functions corr2 or rather corrcoef. > > I wrote a code for that but the resulting matricez are only composed out of NaNs. Is there a genral hint or solving this problem? I plotted the two signals on each other and there must be at least some correlation. > > I'll appreciate any help! > > Yes, read the help carefully the 'rows' option of corrcoef. > Example: > In = [rand(4,1); NaN(4,1)]; > In = [In flipud(In)] > In = > 0.9575 NaN > 0.9649 NaN > 0.1576 NaN > 0.9706 NaN > NaN 0.9706 > NaN 0.1576 > NaN 0.9649 > NaN 0.9575 > > As you can see in this extreme example the series don't have valid overlapping values. > If you don't care you should first align them. > > Oleg
From: Oleg Komarov on 16 Feb 2010 10:03 "Stefanie " <steffi_rulla(a)hotmail.com> wrote in message <hlebbg$g6h$1(a)fred.mathworks.com>... > Hi there, > I'm trying to correlate 2 signals with the functions corr2 or rather corrcoef. > I wrote a code for that but the resulting matricez are only composed out of NaNs. Is there a genral hint or solving this problem? I plotted the two signals on each other and there must be at least some correlation. > I'll appreciate any help! Yes, read the help carefully the 'rows' option of corrcoef. Example: In = [rand(4,1); NaN(4,1)]; In = [In flipud(In)] In = 0.9575 NaN 0.9649 NaN 0.1576 NaN 0.9706 NaN NaN 0.9706 NaN 0.1576 NaN 0.9649 NaN 0.9575 As you can see in this extreme example the series don't have valid overlapping values. If you don't care you should first align them. Oleg
From: Wayne King on 16 Feb 2010 10:02 "Stefanie " <steffi_rulla(a)hotmail.com> wrote in message <hlebbg$g6h$1(a)fred.mathworks.com>... > Hi there, > I'm trying to correlate 2 signals with the functions corr2 or rather corrcoef. > I wrote a code for that but the resulting matricez are only composed out of NaNs. Is there a genral hint or solving this problem? I plotted the two signals on each other and there must be at least some correlation. > I'll appreciate any help! Hi stefanie, are you trying to produce the cross-correlation estimate of two 1D signals? If so, then you want to use xcorr >>doc xcorr Wayne
|
Pages: 1 Prev: cftool and fit - guessing starting values Next: Read malformed text file |