# Finding min point of a second derivative function

3 visualizzazioni (ultimi 30 giorni)
Harel Harel Shattenstein il 8 Lug 2018
Risposto: Eduard Reitmann il 3 Ago 2018
What I have done is:
f=@(x)2./sqrt(pi).*integral(@(t)exp(-t.^2),0,x);
fplot(f,[-5,5])
DELTA=0.01;
X=-5:DELTA:5;
Y=f(X);
DY_DX=diff(Y)./DETLA;
But it does not work, is there an easier way to the first/second derivative? (not symbolic)
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposte (1)

Eduard Reitmann il 3 Ago 2018
You were almost there. Hope this helps. The zero in the differential is a bit crude (just to keep the vectors the same length), but a small enough step size should give you are very accurate answer.
f = @(x) (2./sqrt(pi)).*integral(@(t) exp(-t.^2),0,x);
dx = 0.01;
x = (-5:dx:5)';
y = arrayfun(f,x);
dydx = [0;diff(y)./dx];
d2ydx2 = [0;diff(dydx)./dx];
[dy2d2x_min,minpos] = min(d2ydx2);
x_min = x(minpos)
figure;
plot(x,[y dydx d2ydx2],x_min,dy2d2x_min,'*')
legend('erf(x)','erf''(x)','erf''''(x)')
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Categorie

Scopri di più su Linear Algebra in Help Center e File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by