% function J = energy_fun(param,P,psi_data); alpha_1 = param(1,1); alpha_11 = param(2,1); alpha_111 = param(3,1); psi = alpha_1*P.^2 + alpha_11*P.^4 + alpha_111*P.^6; res = psi - psi_data; J = res'*res;