how to get the missing peak points
Mostrar comentarios más antiguos
Hi all, I just got some problem with this code unable to plot the points on some peaks.
close all
[NUM,TXT,RAW]=xlsread('b3br.csv');
[row,col] = size(NUM); t=NUM(:,1); len = (1:1:row); data=NUM(:,2); clf;
figure(1);
plot(t,data);
Z1=smooth(t,'rlowess'); Z2=smooth(data,14,'rloess'); figure(2); plot(t,Z2);
K = (diff(Z2)); %to calculate the difference in voltage K1 = abs(diff(Z2)); A1 = abs(Z2);
i = 1; j = 1; flag = 0; flag1 = 0; flag2 = 0; temp = 0;
record = ones(1,8);
while(i<row)
if(A1(i)>0.3) if( (A1(i+1) < (A1(i))) && flag == 0)
flag = 1;
record(j)= i;
j = j + 1;
else
if(A1(i) <= 0.5 && flag1 == 0 && flag == 1)
temp = i;
while(A1(temp) < A1(temp - 1))
temp = temp - 1;
end
record(j) = temp ;
j = j + 1;
flag1 = 1;
else
if(A1(i) <= 0.5 && flag2 == 0 && flag == 1)
temp = i;
while(A1(temp) < A1(temp - 1))
temp = temp + 1;
end
record(j) = temp ;
j = j - 1;
flag2 = 1;
end
end
end
i = i + 1;
else i = i + 1; flag = 0; flag1 = 0; flag2 = 0;
end
end
figure(3); plot(len,A1,len(record),A1(record),'r*');
figure(7); plot(len,Z2,len(record),Z2(record),'r*');
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Labels and Styling en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!