help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reading mat file


From: ahowe42
Subject: Re: Reading mat file
Date: Wed, 21 Mar 2012 06:23:54 -0700 (PDT)

I'm a bit confused about who's actually asking this question, as the poster
names keep changing???

Regardless, here's a solution that *won't work for every dataset*, but I
think will work in your case.

% first derivative (kind of)
dx = diff(vvl);
% second derivative (kind of)
dxx = diff([0,dx]);
% peaks (peaks = -2, troughs = 2)
idx = find(dxx == -2);

% now get the peak vvl values & corresponding x values
vvl(idx)
x(idx)

I tested this with a very simple dataset and it worked, but can't guarantee
it will always work.  In particular, if the peak is something like this:
[1,2,3,3,3,2,1], this code will not identify it.  Looking at the plot you
sent me, it should be ok.

Andrew

--
View this message in context: 
http://octave.1599824.n4.nabble.com/Re-Reading-mat-file-tp4487833p4492254.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]