<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/240091</link>
    <title>MATLAB Central Newsreader - How to reverse the algorithm</title>
    <description>Feed for thread: How to reverse the algorithm</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Fri, 28 Nov 2008 22:44:02 -0500</pubDate>
      <title>How to reverse the algorithm</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/240091#613792</link>
      <author>Neo </author>
      <description>N=length(s)&lt;br&gt;
T=1/fs;&lt;br&gt;
t=0:T:(N-1)*T;&lt;br&gt;
fs=fs&lt;br&gt;
&lt;br&gt;
L=100; % length of frames&lt;br&gt;
nframes=floor(length(s)/L) % floor gives integer number of frames&lt;br&gt;
energy=zeros(1,nframes); % An energy array of zeros&lt;br&gt;
&lt;br&gt;
for i=1:nframes&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;index=L*(i-1);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;sum=0;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;for j=1:L;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;sum=sum+s(index+j)*s(index+j); %squaring each frame&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;end&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;energy(i)=sum;&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
m=max(energy);&lt;br&gt;
c=0.1;&lt;br&gt;
z=energy(1)+c*(m-energy(1));&lt;br&gt;
&lt;br&gt;
for i=1:L&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if energy(i)&amp;gt;z&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;startindex=i&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;end&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
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. &lt;br&gt;
&lt;br&gt;
Can anyone please help with this??&lt;br&gt;
&lt;br&gt;
I think using energy(end:-1:1) reverses the energy values.&lt;br&gt;
&lt;br&gt;
Any help is much appreciated</description>
    </item>
    <item>
      <pubDate>Sat, 29 Nov 2008 01:45:04 -0500</pubDate>
      <title>Re: How to reverse the algorithm</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/240091#613800</link>
      <author>Jan Simon</author>
      <description>Dear Neo!&lt;br&gt;
&lt;br&gt;
&amp;gt; for i=1:L&lt;br&gt;
&amp;gt;     if energy(i)&amp;gt;z&lt;br&gt;
&amp;gt;         startindex=i&lt;br&gt;
&amp;gt;     end&lt;br&gt;
&amp;gt; end&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; 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. &lt;br&gt;
&lt;br&gt;
Instead of the loop, you can please FIND to find start and end points:&lt;br&gt;
&amp;nbsp;&amp;nbsp;Index = find(energy &amp;gt; z);&lt;br&gt;
&amp;nbsp;&amp;nbsp;startIndex = Index(1);&lt;br&gt;
&amp;nbsp;&amp;nbsp;endIndex = Index(end);&lt;br&gt;
&lt;br&gt;
Jan</description>
    </item>
  </channel>
</rss>

