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

7 vues (au cours des 30 derniers jours)
Junhao le 6 Mar 2024
Modifié(e) : Chunru le 6 Mar 2024
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
data = a1(:,2)
findpeaks(data,"MinPeakHeight",50,"MinPeakDistance",290)
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

### Réponses (1)

Chunru le 6 Mar 2024
Modifié(e) : Chunru le 6 Mar 2024
% 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)
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

### Catégories

En savoir plus sur Descriptive Statistics dans Help Center et File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by