Findpeaks equivalent on freemat

181 views
Skip to first unread message

Megan

unread,
Jun 10, 2014, 3:41:56 PM6/10/14
to fre...@googlegroups.com
I am very familiar with Matlab and I have a program that used the function findpeaks. Is there any function equivalent in Freemat? Anything close? 

Thank you!

Timothy Cyders

unread,
Jun 10, 2014, 4:08:20 PM6/10/14
to fre...@googlegroups.com
I have a program that finds zero crossings I wrote a number of years ago, but I am not aware of a peak-finding program specifically in Freemat. If you're interested, let me know, and I'll send a copy along.

Cheers,
TJ


On Tue, Jun 10, 2014 at 3:41 PM, Megan <megan....@gmail.com> wrote:
I am very familiar with Matlab and I have a program that used the function findpeaks. Is there any function equivalent in Freemat? Anything close? 

Thank you!

--
You received this message because you are subscribed to the Google Groups "freemat" group.
To unsubscribe from this group and stop receiving emails from it, send an email to freemat+u...@googlegroups.com.
To post to this group, send email to fre...@googlegroups.com.
Visit this group at http://groups.google.com/group/freemat.
For more options, visit https://groups.google.com/d/optout.

Jonathan Weaver

unread,
Jun 11, 2014, 11:33:53 AM6/11/14
to fre...@googlegroups.com
Try this function:

function [pks, loc] = findpeaks(data)
    n = 2:(length(data)-1);
    r = [0 (data(n) > data(n+1) && data(n) > data(n-1)) 0];
    loc = find(r);
    pks = data(loc);
end

newbie

unread,
Jul 6, 2014, 7:32:18 PM7/6/14
to fre...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages