DSPRelated.com
Forums

Multiple Maxima

Started by atran jout March 19, 2005

Dear All,

I have a problem in implementing a simulink
program that detects Multiple max/min of a data
vector.

I will appreciate any help.

thanks in advance
__________________________________





This is a function to locate several local maxima:

function Imax=localMaxs(y,num_maxs)

% LOCALMAXS returns the index of the num_maxs first maximums
% of a data vector y
% Imax=localMaxs(y,num_maxs)
%
% Imax vector containing the maximums indexes
%
% y data vector to be maximized
% num_maxs number of maximums to be found

minim=min(y);
y=y+abs(minim);
M=length(y);
y=y(:)';
yext=[y(M) y y(1)];
maxims=(yext(1:M)<yext(2:M+1))&...
(yext(2:M+1)>yext(3:M+2));
a(i-1)<a(i)<a(i+1)
val_maxims=maxims.*y;
[value,position]=sort(val_maxims);
Imax=position(M-num_maxs+1:M); Hope this helps.

Cheers,
Carles.

--- In , atran jout <ar1978il@y...> wrote:
>
> Dear All,
>
> I have a problem in implementing a simulink
> program that detects Multiple max/min of a data
> vector.
>
> I will appreciate any help.
>
> thanks in advance >
> __________________________________
>



Thank you very much cfprades

But really this solves my problem partially.
I want to know how can I implement this function
on simulink. Since I am working on a project that are
implemented in Simulink to analyze data vector (ECG
data analysis with simulink).

If you or any one how to detect maxima/minima with
simulink it will be great.

Thank you

__________________________________