Need to find "Knees" in Stress Strain curves where slope change abruptly
3 次查看(过去 30 天)
显示 更早的评论
I have stress strain curve which is basically peicewise linear. I need to find everytime there is a sudden change in the slope, the point at which it occurs and the corresponding magnitude. If it were a true local maximum, I can use some tool like "peakFinder" and get the information. But nto all are true peaks but some of them are slope changes. How do I find those. I am attaching a picture here. Thanks in advance.
采纳的回答
Mathieu NOE
2022-1-21
hello
this would be my first suggestion
of course the results may be sensitive to the threshold used in my method (based on the area of a triangle made of 3successive points => we are looking at the points where the triangle hasan area above a given threshold , meaning the two successive segments have a certain angle)
clc
clearvars
data = readmatrix('Test.txt'); % First column is Strain and Second column is Stress
Strain = data(:,1);
Stress = data(:,2);
[A,curv] = compute_curv(Strain,Stress);
% ind = find(curv>1e-5);
ind = find(A>8e-4);
% remove first and last indices which are obviously not to keep
ind = ind(2:end-1);
figure(1)
plot(Strain,Stress,'-+',Strain(ind),Stress(ind),'dr');
function [A,curvature] = compute_curv(x,y)
% run along the curve and find the radius of curvature at each location.
numberOfPoints = length(x);
curvature = zeros(1, numberOfPoints);
for t = 1 : numberOfPoints
if t == 1
index1 = numberOfPoints;
index2 = t;
index3 = t + 1;
elseif t >= numberOfPoints
index1 = t-1;
index2 = t;
index3 = 1;
else
index1 = t-1;
index2 = t;
index3 = t + 1;
end
% Get the 3 points.
x1 = x(index1);
y1 = y(index1);
x2 = x(index2);
y2 = y(index2);
x3 = x(index3);
y3 = y(index3);
a = sqrt((x1-x2)^2+(y1-y2)^2); % The three sides
b = sqrt((x2-x3)^2+(y2-y3)^2);
c = sqrt((x3-x1)^2+(y3-y1)^2);
A(t) = 1/2*abs((x1-x2)*(y3-y2)-(y1-y2)*(x3-x2)); % Area of triangle
curvature(t) = 4*A(t)/(a*b*c); % Curvature of circumscribing circle
end
end
3 个评论
Mathieu NOE
2022-1-24
hello
no , "curv" can be removed , but maybe it would be great to keep it for another problem / task
you can simply comment the line and remove it from the output variables of the function
all the best
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Exploration 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!