Hi Kai
I am trying to do some spectral analysis. Say A is the time-frequency matrix (n is the length of the time dimension, A=matrix(frequency, time). For each time point there are no-more than 3 non zero values in the frequency dimension.
I try to group some values together. That is values are considered to be part of the same group when the frequency proximity of values are within (seuil_frequence);
There are also some coditions on the duration of a groupe (more than delta and less than Delta). I am couting the time duration in compteur, with an initial setting compteur=zeros(n,3).
I am saving the groups in the matrix C.
for i=1:(n-delta)
index1=find(A(:,i));
if length(index1)==0
C(:,i)=0;
else
for j=(i+1):(n-delta)
index2=find(A(:,j));
if length(index2)~=0
for j1=1:length(index1)
for j2=1:length(index2)
B(j1,j2)=abs(f(index1(j1))-f(index2(j2)));
end
[minB(j1), iminB(j1)]=min(B(j1,:));
if ((minB(j1)<=seuil_frequence) & (compteur(i,j1)<=Delta))
C(index2(iminB(j1)),j)=A(index2(iminB(j1)),j);
compteur(i,j1)=compteur(i,j1)+1;
elseif ((minB(j1)>seuil_frequence) & (compteur(i,j1)>=delta))
continue;
elseif (((minB(j1)<=seuil_frequence) & (compteur(i,j1)>Delta)) | ((minB(j1)>seuil_frequence) & (compteur(i,j1)<delta)))
for j3=i:j
C(:,j3)=0;
end
end
end
else
C(:,j)=0;
break;
end
end
end
end
Thank you for your answer, I hope you can see more clearly my problem.
Best regards
Plamen