MATLAB: Obtaning values and plotting Lennard-Jones function

lennard-jonesplot

I need to evaluate the below function which is the Lennard-Jones function defining the van der Waals forces between atoms. The function and the plot it must give are attached. Sigma and epsilon are constants in the function. I tried to write the code for it in couple of different forms and also tried to do it in MS Excel but all of those gave a curve that resembles a saturation curve. Any help would be very appreciated.

Best Answer

Not too much of a problem. You just need to be careful about what you are plotting.
f = @(s) (2*s.^13 - s.^7)./s;
S = linspace(.25,1,100);
plot(1./S,f(S))
grid on
Related Question