フィルターのクリア

Patterns in matlab

1 回表示 (過去 30 日間)
Mate 2u
Mate 2u 2012 年 5 月 7 日
Hi all,
Thank you so much for your help on the forum. I need help. I have some data and I want to check each substring within the data (Value n) and then check if pattern occurs more than once, and if the pattern occurs more than once to calculate the correlation (Value X) of the number of elements after the substring has occured.
For example for an array A:
A = [1 2 2 2 1 2 3 4 1 2 2 2 2 1 2 3 4]
As n = 2. We check every sub-string of size 2. So it checks [1 2], [2 2], [2 2], [2 1].......up to [3 4].
now lets check the first substring which is [1 2]....as X is 2 it will give correlation of 2 values which occur after the pattern at all positions.
eg FIRST output in ARRAY Z would be correlation of [2 2] vs [3 4] vs [2 2] vs [3 4]
Then it will consider the second substring [2 2]
I have a work in progress code as follows
A = [1 2 2 2 1 2 3 4 1 2 2 2 2 1 2 3 4]
n=2; %n
X=2;
for i =1:length(A)-n+1
ZZ= strfind(A,A(i:i+n-1));
if length(ZZ)=1
C(i)=0;
else
for j=1:length(ZZ)
C(i)=corrcoef(
%%This is where I need help.
end
Thank you so much.
  2 件のコメント
Image Analyst
Image Analyst 2012 年 5 月 8 日
What the heck is X? It's not used in your code and I didn't understand your explanation of it. Also I don't know what this means: "correlation of [2 2] vs [3 4] vs [2 2] vs [3 4]". As far as I know you correlate one signal against another signal, and thatdoesn't seem what you're doing. Plus correlation (like from xcorr(), xcorr2(), or normxcorr2()) is different than the correlation coefficient (the corrcoeff() function you used.) Bottom line: I don't know what you want.
Sargondjani
Sargondjani 2012 年 5 月 8 日
i thought it was just me who didnt understand...

サインインしてコメントする。

回答 (1 件)

KUSHAL
KUSHAL 2012 年 11 月 1 日
Even I didn't understand what you need exactly. Kindly put your question neatly and what are your requirements and inputs given for that.

カテゴリ

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