Trying to identify certain peaks in a plot
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Shruthimol
el 22 de Ag. de 2022
Comentada: Mathieu NOE
el 23 de Ag. de 2022
I have managed to plot 2 different plots as shown in the below figures.
In this figure, I have added 2 types of data. The yellow corresponds to a reference undamaged specimen, indicated by the presence of the peaks between 10 and 12 (is called backwall echo). The one in red is indicating presence of damage because of the absense of backwall echo and the increased amplitude between 3 and 8.
In this figure the tested specimen has no damage as there is presence of backwall echo.
I'm ot able to figure out a method to categorize and identify the presence of backwall echo from a given data. Please suggest me some methods so that my output correctly determines if there is damage or not (presence of backwall echo or not).
Thanks in Advance.
0 comentarios
Respuesta aceptada
Mathieu NOE
el 23 de Ag. de 2022
Editada: Mathieu NOE
el 23 de Ag. de 2022
hello
I have reworked your code
check this :
%% Plot of Undamaged Specimen
% na=readmatrix('Default Dataset (4).csv');
% na=readmatrix('Default Dataset (3).csv');
na=readmatrix('Default Dataset (5).csv');
%time
x= na(:,1);
%amplitude
y=na(:,2);
t=0:0.006:12;
D=interp1(x,y,t);
% plot (x,y,t,D);
plot (t,D);
% [v,idx]=findpeaks(D,MinPeakProminence=0.5);
[v,idx]=findpeaks(D,'MinPeakProminence',0.25);
y_threshold = 10;
idx(v>y_threshold)=[];
v(v>y_threshold)=[];
x_threshold=500;
v(idx<x_threshold)=[];
idx(idx<x_threshold)=[];
hold on
scatter(x(idx),v,"y","filled")
%% Plot of Damaged Specimen
nb=readmatrix('Default Dataset (6).csv');
x1= nb(:,1);
y1=nb(:,2);
E=interp1(x1,y1,t); % no need to use u instead of t
hold on
plot (t,E);
% [w,idx]=findpeaks(E,MinPeakProminence=0.5);
[w,idy]=findpeaks(E,'MinPeakProminence',0.25);
y_threshold = 10;
idy(w>y_threshold)=[];
w(w>y_threshold)=[];
x_threshold=500;
w(idy<x_threshold)=[];
idy(idy<x_threshold)=[];
scatter(x(idy),w,"r","filled")
legend('Undamaged Specimen','Peaks of Undamaged Specimen','Tested Specimen','Peaks of Tested Specimen');
hold off
%% Detecting peaks
% Thresholds
xmin_threshold = 10 ;
xmax_threshold = 12 ;
% Remove below min threshold
v(t(idx)<xmin_threshold )=[];
idx(t(idx)<xmin_threshold )=[];
w(t(idy)<xmin_threshold )=[];
idy(t(idy)<xmin_threshold )=[];
% Remove above max threshold
v(t(idx)>xmax_threshold )=[];
idx(t(idx)>xmax_threshold)=[];
w(t(idy)>xmax_threshold )=[];
idy(t(idy)>xmax_threshold)=[];
n=numel(v); % <= here
m=numel(w); % <= here
% if (n>m)
% disp('The specimen is showing characteristics of damage at this site.');
% else
% disp('The specimen is showing no characteristics of damage at this site.');
% end
%% simpler alternative : if m>0 the tested specimen is OK (whatever the n value is)
if (m>0)
disp('The specimen is showing no characteristics of damage at this site.');
else
disp('The specimen is showing characteristics of damage at this site.');
end
3 comentarios
Mathieu NOE
el 23 de Ag. de 2022
My pleasure !
Glad you could recognize where I did the mods , as I was a bit lazy on the comments today !
all the best !
Más respuestas (0)
Ver también
Categorías
Más información sobre Annotations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!