help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Min function problem


From: Plamen Bokov
Subject: Re: Min function problem
Date: Sun, 12 Jan 2014 14:01:42 +0100

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


2014/1/12 Kai Torben Ohlhus <address@hidden>
On Sun, Jan 12, 2014 at 3:51 AM, plamen <address@hidden> wrote:
Hello,
I am having the following problem

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)<=some_value)

C(index2(iminB(j1)),j)=A(index2(iminB(j1)),j);


and when I run the script I am getting an error message A(I): index out of
bounds; value 2 out of bound 1
on the line where I call index(iminB(j1))

How is that possible, whereas the values of iminB are chosen between the
index of index2?
Thanks for your advice
Plamen



--
View this message in context: http://octave.1599824.n4.nabble.com/Min-function-problem-tp4660968.html
Sent from the Octave - General mailing list archive at Nabble.com.
_______________________________________________
Help-octave mailing list
address@hidden
https://mailman.cae.wisc.edu/listinfo/help-octave

Hello Plamen,

can you provide a minimal and executable code sample (with e.g. your input data, as I have no clue about the dimensions of these values).

Best,
Kai


reply via email to

[Prev in Thread] Current Thread [Next in Thread]