208 views (last 30 days)

Star Strider
on 12 Jul 2016

Star Strider
on 15 Jul 2016

The sign change does make a difference, in addition to which I now know the correct independent and dependent variables. (See: Draw tangent line in step response ?)

I have no idea how you chose that one point. I ran my previous analysis in the link with your data, and I still cannot identify any true inflection points that corresponds to that point. I did this even after using polyfit to smooth out the noise. (I got an acceptable fit, but this did not permit the identification of the point you plotted.)

This is the best I can do:

[d,s,r] = xlsread('cloudy snow 30ppmGE.xlsx');

I = -d(:,1); % Current

E = d(:,2); % Potential

t = E(E<=0);

y = I(E<=0);

[b,S,mu] = polyfit(t, y, 6);

fy = polyval(b,t,S,mu);

y = fy;

d1y = gradient(y,t); % Numerical Derivative

d2y = gradient(d1y,t); % Numerical Second Derivative

t_infl = interp1(d1y, t, max(d1y)); % Find ‘t’ At Maximum Of First Derivative

y_infl = interp1(t, y, t_infl); % Find ‘y’ At Maximum Of First Derivative

slope = interp1(t, d1y, t_infl); % Slope Defined Here As Maximum Of First Derivative

intcpt = y_infl - slope*t_infl; % Calculate Intercept

tngt = slope*t + intcpt; % Calculate Tangent Line

figure(1)

plot(t, y)

hold on

plot(t, fy)

plot(t, d1y, '-.m', t, d2y, '--c') % Plot Derivatives (Optional)

plot(t, tngt, '-r', 'LineWidth',1) % Plot Tangent Line

plot(t_infl, y_infl, 'bp') % Plot Maximum Slope

hold off

grid

legend('y(t)', 'y(t) Fit', 'dy/dt', 'd^2y/dt^2', 'Tangent', 'Location','E')

axis([xlim min(min(y),intcpt) ceil(max(y))])

Your data do not otherwise have anything that I can identify as an inflection point. If you have a mathematical model of the process that produced your data that you can fit to it using nonlinear regression techniques, that could provide a way to calculate the inflection points. I cannot do it from your data and get any point in the region of the red ‘*’.

Opportunities for recent engineering grads.

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

Start Hunting!
## 4 Comments

## Direct link to this comment

https://es.mathworks.com/matlabcentral/answers/295156-how-to-find-the-inflection-point-of-a-curve-in-matlab#comment_378820

⋮## Direct link to this comment

https://es.mathworks.com/matlabcentral/answers/295156-how-to-find-the-inflection-point-of-a-curve-in-matlab#comment_378820

## Direct link to this comment

https://es.mathworks.com/matlabcentral/answers/295156-how-to-find-the-inflection-point-of-a-curve-in-matlab#comment_379011

⋮## Direct link to this comment

https://es.mathworks.com/matlabcentral/answers/295156-how-to-find-the-inflection-point-of-a-curve-in-matlab#comment_379011

## Direct link to this comment

https://es.mathworks.com/matlabcentral/answers/295156-how-to-find-the-inflection-point-of-a-curve-in-matlab#comment_379406

⋮## Direct link to this comment

https://es.mathworks.com/matlabcentral/answers/295156-how-to-find-the-inflection-point-of-a-curve-in-matlab#comment_379406

## Direct link to this comment

https://es.mathworks.com/matlabcentral/answers/295156-how-to-find-the-inflection-point-of-a-curve-in-matlab#comment_379412

⋮## Direct link to this comment

https://es.mathworks.com/matlabcentral/answers/295156-how-to-find-the-inflection-point-of-a-curve-in-matlab#comment_379412

Sign in to comment.