如何标记低于 500 的值?

How to mark what is under the 500 value?

我想用星号或其他任何东西标记 500 以下的峰并将其命名为 'Q-wave' 或在该点放置一条彩色垂直线?

有人知道怎么做吗?

谢谢!!

使用findpeaks。下图和代码显示了一些示例。

% Create some data
load sunspot.dat
data = sunspot(1:200,2)*4 + 180;

% Plot the data
plot(data, 'm'); hold on; grid on;
ylim([0,1000]);

% all local maxima
[pks, locs] = findpeaks(data);
plot(locs, pks, 'ro');

% all local minima -- the trick is to invert the data:
[pks, locs] = findpeaks(-data);
plot(locs, -pks, 'bo');

% local maxima greater than 500
[pks, locs] = findpeaks(data, 'MinPeakHeight', 500);
plot(locs, pks, 'r*');

% local minima less than 200
[pks, locs] = findpeaks(-data, 'MinPeakHeight', -200);
plot(locs, -pks, 'b*');

% local maxima less than 400 -- the trick is to apply treshold to the pks
[pks, locs] = findpeaks(data);
locs(pks > 400) = []; % delete unwanted data points
pks(pks > 400) = [];  % delete unwanted data points
plot(locs, pks, 'kV', 'MarkerSize', 5);

legend({
    'data'
    'all local maxima points'
    'all local minima points'
    'maxima greater than 500'
    'minima less than 200'
    'local maxima less than 400'
    });