filname = sprintf('H1, 2_I1sv%05d.txt',i);
dat(i) =importdata(filname,delimiter,header);
FRFdata = readmatrix(filname, 'HeaderLines',9);
[Ypk,Xpk,Wpk,Ppk] = findpeaks(amp(ind),'MinPeakProminence',mpp, 'WidthReference','halfheight');
[pv,mxidx] = maxk(Ppk,4);
subplot(2,1,1),plot(f,amp,f(Xpk),Ypk,'dr')
subplot(2,1,2),plot(f,pha, f(Xpk),pha(Xpk),'dr')
sgtitle("File "+string(i))
Results = table([freq{:}],[Ypkc{:}],[pha_{:}],[Xpkc{:}], 'VariableNames',{'Frequency','peak amp','Phase','peak locations '})
Results =
Frequency peak amp Phase peak locations
______________ ____________________ __________________ _______________
19 19.125 0.20233 2.2867 -104.91 -102.27 191 52
6 14.25 0.10132 1.5843 -76.11 112.51 61 39
13.6 25.5 0.095354 0.29818 18.393 -41.026 137 69
25.3 6 0.022303 0.10936 84.422 75.346 254 17
clear a amp b dat delimiter f filname freq FRFdata;
clear header i ind mpp mxidx Ppk Ppkc pv Wpk Wpkc Xpk Xpkc Ypk Ypkc pha pha_;