Need to find "Knees" in Stress Strain curves where slope change abruptly
조회 수: 4 (최근 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.
댓글 수: 7
채택된 답변
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!