First you need to make these potentials comparable - now your LJ12-6 has the dissociation-energy as the zero-level, while your Morse-potential has the minimum-energy as zero-level (which makes its dissociation energy D):
LJ12_6 = @(D,r0,E0,r)D*(((r0./r).^12)-2*(r0./r).^6)+D;
Then when you plot over all your values of r, you will see that the two potentials diverge "quite a bit" for small values, whether this is relevant or not you should think about (my understanding is that you shouldn't bother much about energies more than ~3 times (or some such small factor) the dissociation energy since that would correspond to vibrational energies way larger than a molecule can have, and correspondingly small amplitudes of the wave-function). Once you've zoomed in you will see that the potentials overlap rather well for r larger than r0 but diverge for smaller values - therefore fitting makes little sense. But you can do that fitting like this:
Morse_E = @(D,alpha,r0,r)D*(1-exp(-alpha*(r-r0))).^2
LJ12_6 = @(D,r0,r)D*(((r0./r).^12)-2*(r0./r).^6)+D
pot_diff = @(p,r) sum(( LJ12_6(p(1),p(2),r) - Morse_E(D,alpha,r0,r)).^2);
[par_LJ2,out2,out3] = fminsearch(@(p) pot_diff(p,r),[D,r0]);
plot(r,[LJ12_6(D,r0,r);Morse_E(D,alpha,r0,r);LJ12_6(par_LJ2(1),par_LJ2(2),r)])
The main problem you'll have is that the two potentials model different physical systems, Morse model vibrational states in di-atmic molecules and LJ models other interactions between atoms and molecules.
HTH
Best Answer