Find local min point in plot
4 ビュー (過去 30 日間)
古いコメントを表示
Hello,
I am trying to find the local min on my plot but i want it to find only the minimun of the local min point.
this is my code:
clear all;
clc;
Wavelength = xlsread('Calcite.xlsx','A6:A2156');
reflection = xlsread('Calcite.xlsx','B6:B2156');
lmin=islocalmin(reflection);
figure;
plot(Wavelength,reflection,Wavelength(lmin),reflection(lmin),'ro')
title('(111b Sample) Relative Reflectance--Wavelength')
xlabel('Wavelength[nm]')
ylabel('Relative Reflectance')
grid on
grid minor
as you can see i get all the min points but i want to get only the minimum of the local min.
Thank you for your help.
0 件のコメント
採用された回答
Cris LaPierre
2022 年 1 月 13 日
I suggest trying out the 'Find local extrema' live task. This will allow you to interactively set criterial for finding maxima and minima in your signal. Once you have the correct parameters, you can convert the task to code if you want, or keep the task in your live script.
その他の回答 (1 件)
Voss
2022 年 1 月 13 日
clear all;
clc;
Wavelength = xlsread('Calcite.xlsx','A6:A2156');
reflection = xlsread('Calcite.xlsx','B6:B2156');
% lmin=islocalmin(reflection);
lmin = find(islocalmin(reflection));
[~,idx] = min(reflection(lmin));
idx = lmin(idx);
figure;
% plot(Wavelength,reflection,Wavelength(lmin),reflection(lmin),'ro')
plot(Wavelength,reflection,Wavelength(idx),reflection(idx),'ro');
title('(111b Sample) Relative Reflectance--Wavelength')
xlabel('Wavelength[nm]')
ylabel('Relative Reflectance')
grid on
grid minor
4 件のコメント
Voss
2022 年 1 月 14 日
I interpreted "find only the minimun of the local min point" to mean "find the lowest local minimum". So yeah, if you want to ignore certain local minima because they are close to another local minimum or whatever, you can't use my code for that.
参考
カテゴリ
Help Center および File Exchange で Annotations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!