How do I find the coordinates of the point at which the derivative is 0?

1 view (last 30 days)
e=1;
sigma=0.154;
r=linspace(0.154,1,100);
U = @(r) 4*e*((sigma./r).^12)-((sigma./r).^6);
norm_r = r./sigma;
figure
plot(norm_r,U(r))
title('Lennard-Jones Potential')
xlabel('Distance (nm)')
ylabel('Potential Energy')

Answers (1)

Walter Roberson
Walter Roberson on 20 Feb 2018
If you have the Symbolic Toolbox, then
r=linspace(0.154,1,100);
syms R real
location_of_zero_deriv = solve(diff(U(R),R),R);
mask = location_of_zero_deriv >= r(1) & location_of_zero_deriv <= r(end);
location_of_zero_deriv = double( location_of_zero_deriv(mask) );

Tags

Community Treasure Hunt

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

Start Hunting!