second largest peak value
    21 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
    Ramesh Bala
 il 12 Giu 2019
  
    
    
    
    
    Commentato: Ramesh Bala
 il 6 Ago 2019
            I'm getting the amp of second largest peak as correct but the time is wrong ?
How to obtain the second highest value X,Y from this and plot as already Y is correct ,X seems to be in wrong region?
s=load ('30827.mat');
signal(1,1:length(s.ans))=s.ans;
load t.mat;
[PkAmp, PkTime] = findpeaks(abs(hilbert(signal(1,:))),t); 
[highestPeak, indexOfHighestPeak] = max(PkAmp);
[a(1),b2]=max(abs(hilbert(signal(1,:))));  
[a2(1),b6]=max(PkAmp(PkAmp<max(PkAmp))); % to get second largest peak value
 % error is the time value calcluate and plotted wrong??
Highesttime(1,:) = t(b2);
Highest2time(1,:) = t(b6);
figure;
    plot(t,(signal(1,:)),t,abs(hilbert(signal(1,:))),t(b2),a(1),'ro')
    hold on
    plot(PkTime, PkAmp, '^r', 'MarkerFaceColor','r')
    xlim([0 0.0006]);ylim([-inf inf])
    grid on
    hold on,plot(t(b6),a2(1),'ko')
    hold off
0 Commenti
Risposta accettata
  Alex Mcaulley
      
 il 12 Giu 2019
        To obtain the coordinates of the second peak you just need:
[PkAmp, PkTime] = findpeaks(abs(hilbert(signal(1,:))),t); 
[~,idx] = sort(PkAmp,'descend');
PkAmp(idx(2)) %Amplitude of the second peak
PkTime(idx(2)) %Time of the second peak
13 Commenti
Più risposte (1)
Vedere anche
Categorie
				Scopri di più su Polar Plots in Help Center e File Exchange
			
	Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
