Matlab exercise07

编程知识 更新时间:2023-05-01 23:46:43

Using potential.txt, where the first column is distance ® in Angstrom and second column is energy (E) in atomic units, find a potential representation in the following forms
(a) Lennard-Jones potential - find parameters epsilon and sigma
(b) Buckingham potential - find parameters A, B, C.

使用 potential.txt,其中第一列是以埃为单位的距离 ®,第二列是以原子单位为单位的能量 (E),找到以下形式的潜在表示
(a) Lennard-Jones 势——找到参数 epsilon 和 sigma
(b) Buckingham potential - 找到参数 A、B、C。

% write solution here 
D = load('potential.txt'); 
r = D(7:end,1); 
e = D(7:end,2); 
% simplify Vlj(r) = a*r^-12 - b*r^-6
% linear parameters solution via set of equations
eq = [r.^-12  -r.^-6];
p = eq\e; 
elj = p(1).*r.^-12 - p(2).*r.^-6; 

plot(r,e,'rs'); hold on
plot(r,elj,'g-');
% NOTICE that elj > 0 p(2) < 0, thus fit provides a repulsive curve
% if you want to improve LJ-fit you need to remove some points from the
% repulsion region - we are fitting 2 parameters, thus there is enough
% points in the input data. 

% V(r) = A*exp(-Bx) - C/r^6
bug = @(p,r) p(1).*exp(-p(2).*r) - p(3).*r.^-6;
p0 = [1 1 1]; 
p = lsqcurvefit(bug,p0,r,e);

plot(r,bug(p,r),'b-');
legend('DATA','LJ','Buck'); 

% check the parameter stability for both p0 vectors? 
% Any ideas - how to improve on numerical stability?

更多推荐

Matlab exercise07

本文发布于:2023-04-24 14:48:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/4631a76136c3127ca3f5d3779d6f2557.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Matlab

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!

  • 100824文章数
  • 26067阅读数
  • 0评论数