Matlab

Moderators: None (Apply to moderate this forum)
Number of threads: 1471
Number of posts: 2147

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
how to create matrix with function Posted by birdswords on 23 May 2012 at 10:14 AM

Hi All, I am trying to count peaks in a time series that meet certain conditions, and keep their location.
My code is:

function [xx] = reducetopeak(xx);
[locs pks]=peakseek(xx,2,0.001);

%First problem, I get an error message stating I do not have enough input variables.

nnn = length(locs);
for i=nnn-1
if (locs(i+1) - locs(i)) <= abs(3);
locs(i) = 0;
end
end
peaks = nnz(locs);

This allows me to count only the peaks that satisfy the statement, but I need to the location of those peaks in xx.

Thanks!-cs



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.