RESU = [ 20,-9.7957; 21.9995,-9.7713; 23.9998,-9.758; 24.0001,-9.7513; 25.9999,-9.7368; 26,-9.7298; 29.9996,-9.6904; 34.9998,-9.6234; 35,-9.6164; 39.9998,-9.5417; 40,-9.5493; 50.0002,-9.3761; 77.17,-8.754; 90.0001,-8.4044; 149.9992,-6.2687; 199.9988,-3.9821; 273.15,0.001; 372.7,6.332] // 5 parameters function y = curve(x,coef) A4 = coef(1) A3 = coef(2) A2 = coef(3) A1 = coef(4) A0 = coef(5) y = (A4*(x^4)) + (A3*(x^3)) + (A2*(x^2)) + (A1*x) + A0 endfunction // function descriptor function e = G(parameters,test) x_test = test(1) y_test = test(2) e = y_test - curve(x_test,parameters) endfunction // Solve the problem parameters_init = [0.1 ; 0.1 ; 0.1 ; 0.1 ; 0.1] [parameters_opti,err] = datafit(G,RESU',parameters_init) // Drawing of the experimental data & the fitted curve y_calc = zeros(Line_number,1); for i = 1 : Line_number y_calc(i,1) = curve(RESU(i,1),parameters_opti); end; clf(0) plot2d(RESU(:,1),RESU(:,2),style=-2) plot2d(RESU(:,1), y_calc, style = 2) legend(["Experimental data", "fitted curve"],2);