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

3 次查看(过去 30 天)
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')

回答(1 个)

Walter Roberson
Walter Roberson 2018-2-20
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) );

类别

Help CenterFile Exchange 中查找有关 Calculus 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by