필터 지우기
필터 지우기

i found out the peaks of a signal as well as its locations but i have not been able to plot the peaks in the signal can anyone please help

조회 수: 2 (최근 30일)
the matlab code i used was [pks,locs] = findpeaks(x1,'MINPEAKDISTANCE',40,'MINPEAKHEIGHT',0.12); now how can i show the peaks while plotting the graph

채택된 답변

Wayne King
Wayne King 2013년 3월 6일
Have you looked at the findpeaks reference page in the documentation, which has an example doing exactly that?
x = linspace(0,1,1024);
Pos = [0.1 0.13 0.15 0.23 0.25 0.40 ...
0.44 0.65 0.76 0.78 0.81];
Hgt = [ 4 5 3 4 5 4.2 2.1 4.3 3.1 5.1 4.2];
Wdt = [.005 .005 .006 .01 .01 .03 .01 .01 .005 .008 .005];
PeakSig = zeros(size(x));
for n =1:length(Pos)
PeakSig = ...
PeakSig + Hgt(n)./( 1 + abs((x - Pos(n))./Wdt(n))).^4;
end
% find peaks with defaults
[pks,locs] = findpeaks(PeakSig);
plot(x,PeakSig); hold on;
% offset values of peak heights for plotting
plot(x(locs),pks+0.05,'k^','markerfacecolor',[1 0 0]);

추가 답변 (0개)

카테고리

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