Matlab exercise07

该博客探讨如何使用MATLAB从potential.txt文件中提取距离和能量数据,然后分别对Lennard-Jones势和Buckingham势进行参数拟合。通过线性方程组求解Lennard-Jones势的参数epsilon和sigma,以及Buckingham势的参数A、B、C。博客中展示了拟合曲线,并讨论了数值稳定性问题。
摘要由CSDN通过智能技术生成

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?
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

哇小侠

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值