How to find inflection point of a curve

29 views (last 30 days)
Hello guys.
I am looking for some information.
Maybe you can help me ?
I need to find the inflection point of a curve.
I know that I can use the second derivative or use the tangent but I don't know how to applicate or calculte it in matlab ?
Here you'll fin the curve
it represent the transition from elastic to plastic domain.
Thank you.

Accepted Answer

Star Strider
Star Strider on 4 Oct 2022
Edited: Star Strider on 4 Oct 2022
First, use the sgolayfilt function to eliminiate as much of the noise as possible, since taking the derivative will amplify it. The use the gradient function to calculate the numerical derivative, for example:
framelen = 101;
ys = sgolayfilt(y, 3, framelen);
dydx = gradient(ys) ./ gradient(x);
Choose the appropriate value for ‘framelen’ to get the desired result.
EDIT — (4 Oct 2022 at 20:40)
Example —
x = linspace(0.9,1.8, 250); % Create Data
y = exp(-(x-1.3).^2*50)/8 + x +0.005*randn(size(x)); % Create Data
% figure
% plot(x, y)
% grid
ydt = detrend(y,1); % Detrend 'y' To Facilitate Analysis
framelen = 101; % Choose Appropriate Value
ydts = sgolayfilt(ydt, 3, framelen); % Denoise Signal
dydx = gradient(ydts) ./ gradient(x); % Calculate Numerical Derivative
[maxdydx,idxmax] = max(dydx); % Interpolation Index Lower Limit
[mindydx,idxmin] = min(dydx); % Interpolation Index Upper Limit
idxrng = idxmax : idxmin;
inflptx = interp1(dydx(idxrng), x(idxrng), 0) % Find Inflection Point X-Value
inflptx = 1.3014
inflpty = interp1(x, y, inflptx) % Find Inflection Point Y-Value
inflpty = 1.4191
plot(x, y, 'DisplayName','Data')
hold on
plot(inflptx, inflpty, '+r', 'MarkerSize',10, 'DisplayName','Inflection Point')
hold off
Star Strider
Star Strider on 6 Oct 2022
My pleasure!
If my Answer helped you solve your problem, please Accept it!

Sign in to comment.

More Answers (0)


Find more on Tables in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!