Finding global maximum in matlab
Can any body know how to find the global maximum of a signal in matlab.
Any help wi开发者_JS百科ll be highly appreciated. Thanks
assuming your signal is a vector x, just do
[max_value, index_number] = max(x)
max_value will be the biggest value and index_number will be the index number of your original vector x.
the biggest peak is not always the maximum it can always be the first or last element in the vector (if of curse you really mean the biggest peak and not maximum of function )
[~,indexes]=findpeaks(x,'SORTSTR','descend');
i=indexes(1);
This is a very bad question as not enough information has been provided by the OP. but fminbnd()
might be a good option to look into:
clear; close all; clc;
myFun = @(x) -min(sin(x), x^2);
[x1, y1] = fminbnd(myFun, -1, 2);
You can use isoutlier function like this example
A = [57 59 60 100 59 58 57 58 300 61 62 60 62 58 57];
TF = isoutlier(A)
If you want only specific parts, you can divide your vector as isoutlier(A(5:25)) or similar
精彩评论