corrcoef command

2 ビュー (過去 30 日間)
Richard
Richard 2012 年 1 月 10 日
If I need to find the correlation between two vectors by using corrcoef, is it possible to use it if nan appears in the data? and if not how is it possible to find the correlation if nan is present? Do I need to interpolate over the nan's with the surrounding values?
Also, is it also possible to find the correlation between more than one vector?

回答 (2 件)

Wayne King
Wayne King 2012 年 1 月 10 日
Yes, the data can have NaNs, but you then have to use the 'rows' input and set one of the values to:
Either 'all' (default) to use all rows, 'complete' to use rows with no NaN values, or 'pairwise' to compute R(i,j) using rows with no NaN values in either column i or j.
That is straight from the documentation.
Yes, you can input multiple vectors, each row is an observation and the columns are the variables. That is also documented.

Sravantej
Sravantej 2012 年 1 月 10 日
hi lestyn, you can also get correlation between two vectors using xcorr [x,lag]=xcorr(s1,s2); [max,ind]=max(abs(x)); delay=lag(ind); Here, x gives correlation values and delay gives the delay between the two vectors

カテゴリ

Help Center および File ExchangeCorrelation and Convolution についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by