Filter löschen
Filter löschen

How to draw tangent line at infleciton point?

20 Ansichten (letzte 30 Tage)
x y
x y am 14 Nov. 2015
Kommentiert: Star Strider am 12 Dez. 2020
Hy
I would like to draw line to curve at inflection point... the code what I use to find a the point is:
figure(1)
load('data.mat')
plot(t,y);
hold on;
ypp = diff(y,2);
% Find the root using FZERO
t_infl = fzero(@(T) interp1(t(2:end-1),ypp,T,'linear','extrap'),0)
y_infl = interp1(t,y,t_infl,'linear')
plot(t_infl,y_infl,'ro');
hold off;
  2 Kommentare
jayraj rajput
jayraj rajput am 12 Dez. 2020
can you share your matlab code for draw tangent at inflection point ?
Star Strider
Star Strider am 12 Dez. 2020
Jayraj Rajput —
See my Comment.
(A Vote for my Answer would be appreciated!)

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Star Strider
Star Strider am 15 Nov. 2015
You have the slope at the inflection point as well as the ‘t’ and ‘y’ values at the inflection point, so all you need to do to draw the tangent line at the inflection point is to calculate the slope ‘b’, and that is straightforward.
I would use the gradient function to calculate the derivative, not diff, and the del2 function to calculate the second derivative, both because they are more accurate and because the result of each vector is the same length as the input vector.
  5 Kommentare
blpanther
blpanther am 18 Mär. 2016
Hi, I try to run this script - I have just two columns of excel data and I get the following errors when trying to run: Error using griddedInterpolant The grid vectors must contain unique points.
Error in interp1 (line 161) F = griddedInterpolant(X,V,method);
Error in test1 (line 6) t_infl = interp1(d1y, t, max(d1y)); % Find ‘t’ At Maximum Of First Derivative
what can be causing this problem? Many thanks
Pedro Inácio
Pedro Inácio am 17 Okt. 2017
Hi, I think you just need to change the line:
t_infl = interp1(d1y, t, max(d1y));
By,
t_infl = interp1(t, d1y, max(d1y));
I hope it helps.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Graphics Performance finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by