Well, I read that Sample Entropy would be a better than Approximate entropy, so I changed to that. Though now I have big problems of speeding it up, I guess I will post about it now..
Thanks!
Aino
"Aino" <aino.tietavainen@removeThis.helsinki.fi> wrote in message <hujj9q$496$1@fred.mathworks.com>...
> Hi all!
>
> I am trying to make a code for calculating approximate entropy (Pincus 1996). Since the measure is somewhat random (personal opinion..) I compared my code with another one I found in this forum (http://www.mathworks.com/matlabcentral/newsreader/view_thread/259062#712823). I didn't get exactly the same results.. At least the logarithm is taken in a bit later point in the code than in the other code. Here's my code (cop is the signal):
>
> function AppEnt=ApproxEntropy(cop,M,r)
>
> N=length(cop);
> count1=0;
> count2=0;
> CIM=[];
>
> for m=[M,M+1]
> Cim=NaN(1,Nm+1);
>
> for i=1:Nm+1
> seg_i=cop(i:i+m1);
>
> for j=1:Nm+1
> seg_j=cop(j:j+m1);
>
> for k=1:m
> if abs(seg_i(k)seg_j(k))>r
> count1=count1+1;
> end
> end
>
> if count1==0
> count2=count2+1;
> end
> count1=0;
> end
>
> Cim(i)=count2/(Nm+1);
> count2=0;
> end
> CIM=cat(2,CIM,sum(log(Cim))/(Nm+1));
> end
>
> AppEnt=CIM(1)CIM(2);
>
> Could you help me see if there is something wrong with it? Also, if I put random noise in to the code, it doesn't give out "a big number" (what ever that means).
>
> Also, can I use this as a cross approximate entropy if I change the seg_j to be from another signal?
>
> Thank you so much!
>
> Aino
