Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: How to reverse the algorithm
Date: Fri, 28 Nov 2008 22:44:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 35
Message-ID: <ggps7i$qok$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1227912242 27412 172.30.248.37 (28 Nov 2008 22:44:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 28 Nov 2008 22:44:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 892175
Xref: news.mathworks.com comp.soft-sys.matlab:503722


N=length(s)
T=1/fs;
t=0:T:(N-1)*T;
fs=fs

L=100; % length of frames
nframes=floor(length(s)/L) % floor gives integer number of frames
energy=zeros(1,nframes); % An energy array of zeros

for i=1:nframes
    index=L*(i-1);
    sum=0;
    for j=1:L;
        sum=sum+s(index+j)*s(index+j); %squaring each frame
    end
    energy(i)=sum;
end

m=max(energy);
c=0.1;
z=energy(1)+c*(m-energy(1));

for i=1:L
    if energy(i)>z
        startindex=i
    end
end

Hi I have this program to  find the first frame where energy is above Z, hence found the start of a word. I now need to reverse the energy matrix and perform the algorithm again to find the end of the word. 

Can anyone please help with this??

I think using energy(end:-1:1) reverses the energy values.

Any help is much appreciated