필터 지우기
필터 지우기

Finding the mean values of peak values using "findpeaks" function and displaying it

조회 수: 1 (최근 30일)
Junhao
Junhao 2024년 3월 6일
편집: Chunru 2024년 3월 6일
How do you find the mean values of specified peak values using "findpeaks" function and displaying it.
Below is my code of generating this graph
load a1.mat
data = a1(:,2)
findpeaks(data,"MinPeakHeight",50,"MinPeakDistance",290)

답변 (1개)

Chunru
Chunru 2024년 3월 6일
편집: Chunru 2024년 3월 6일
% load a1.mat
% data = a1(:,2)
% sample data
x = linspace(0,1,1000);
Pos = [1 2 3 5 7 8]/10;
Hgt = [3 4 4 2 2 3];
Wdt = [2 6 3 3 4 6]/100;
for n = 1:length(Pos)
Gauss(n,:) = Hgt(n)*exp(-((x - Pos(n))/Wdt(n)).^2);
end
data = sum(Gauss);
[pks, loc] = findpeaks(data,"MinPeakHeight",2.50,"MinPeakDistance",10, "Annotate", "peaks");
plot(x, data, "b-", x(loc), pks, 'rv')
mp = mean(pks);
title("Mean Peak: "+mp)

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by