Cubic fit

Use the fitcubic function:

using EasyFit, Plots, Random
Random.seed!(1)

x = sort(rand(10))
y = x .^ 3 .+ 0.1 * rand(10)

fit = fitcubic(x, y)
------------------- Cubic Fit -----------------

Equation: y = ax^3 + bx^2 + cx + d

With: a = 0.048390869335431
      b = 1.4420079102735532
      c = -0.619124269918306
      d = 0.10355720959037208

Correlation coefficient, R² = 0.9878064946938877
Average square residue = 0.0006187983258828182

Predicted Y: ypred = [ 0.08947765126558407, 0.07660607925686806, ...]
residues = [ -0.004968161728546042, 0.03038218264619519, ...]

-----------------------------------------------
scatter(x, y, label="data", framestyle=:box)
plot!(fit.x, fit.y, label="fit", linewidth=2)
Example block output