How to find inflection point of a curve
76 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
harith larabi
il 4 Ott 2022
Commentato: Star Strider
il 6 Ott 2022
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.
Regards
Harith
0 Commenti
Risposta accettata
Star Strider
il 4 Ott 2022
Modificato: Star Strider
il 4 Ott 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
inflpty = interp1(x, y, inflptx) % Find Inflection Point Y-Value
figure
plot(x, y, 'DisplayName','Data')
hold on
plot(inflptx, inflpty, '+r', 'MarkerSize',10, 'DisplayName','Inflection Point')
hold off
grid
xlabel('X')
ylabel('Y')
legend('Location','best')
.
8 Commenti
Star Strider
il 6 Ott 2022
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.
Più risposte (0)
Vedere anche
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!