MATLAB: How to get the minimum/maximum of one of the graphs I have plotted

plotplotting

a=[.2:.01:1];
E_A=(-1.436)./a;
E_R=(5.86*10.^(-6))./(a.^9);
E_N=E_A+E_R; % <<<<<<----- I am trying to find the min of this equation but i cant figure out how to
plot(a,E_A);
hold on
plot(a,E_R);
plot(a,E_N);
title('Energy vs. Distance between atoms')
ylabel('Energy (eV)')
xlabel('Distance between atoms (nm)')
legend('E_A','E_R','E_N')

Best Answer

[min_E_N, min_pos] = min(E_N);
[max_E_N, max_pos] = max(E_N);
a_at_min = a(min_pos);
a_at_max = a(max_pos);
plot(a_at_min, min_E_N, 'rv', a_at_max, max_E_N, 'g^')