How do I plot a point at the x intercept on this graph?

1 次查看(过去 30 天)
e=1;
sigma=0.154;
r=linspace(0.154,1,100);
U = @(e,sigma,r) 4*e*((sigma./r).^12)-((sigma./r).^6);
norm_r = r./sigma;
figure
plot(norm_r,U(e,sigma,r))
title('Lennard-Jones Potential')
xlabel('Distance (nm)')
ylabel('Potential Energy')
  2 个评论
Rhianne Tallarico
Rhianne Tallarico 2018-2-20
This code plots a curved line, I am looking to find the x intercept value of the line, and plot a marker at that point. Thanks!

请先登录,再进行评论。

回答(1 个)

Are Mjaavatten
Are Mjaavatten 2018-2-20
Let U be a function of r only and find the solution to U(r) = 0:
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')
norm_r_0 = fzero(U,1)/sigma;
hold on; plot(norm_r_0,0,'*r')

类别

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

标签

Community Treasure Hunt

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

Start Hunting!

Translated by