Find local min point in plot

4 ビュー (過去 30 日間)
Anton Vernytsky
Anton Vernytsky 2022 年 1 月 13 日
コメント済み: Voss 2022 年 1 月 14 日
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.

採用された回答

Cris LaPierre
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 件のコメント
Anton Vernytsky
Anton Vernytsky 2022 年 1 月 13 日
Thank you ! it helped me.

サインインしてコメントする。

その他の回答 (1 件)

Voss
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 件のコメント
Anton Vernytsky
Anton Vernytsky 2022 年 1 月 14 日
It only showed me the lowest point,what i did was the first solution,this is the code and plot:
clear all;
clc;
Wavelength = xlsread('Calcite.xlsx','A6:A2156');
reflection = xlsread('Calcite.xlsx','B6:B2156');
lmin = islocalmin(reflection,"MinSeparation",300);
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
Voss
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 ExchangeAnnotations についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by