I have points and need to get equation of these points. I try to use wolfram and another online services and all result is bad.
You could use Polynomials.jl to fit a polynomial in the y-axis variable.
For a 4th-order polynomial, this gives:
2 Likes
Thank you very much!
Can you share code? I don’t know how to convert data from .mat
to .jl
. I can convert to numpy array and then to .jl
, but it long
Sorry, I did this in the REPL and the code is a mess to cut and paste.
To read the Matlab files, I have used the MAT.jl package.
What am i doing wrong?
f4 = fit(I0_data, U0_data, 4)
-725636.891507482 - 1.9486539668049992e6∙x - 1.9622241946502575e6∙x^2 - 878106.3537953914∙x^3 - 147347.79216010476∙x^4
function equat(x)
-725636.891507482 .- 1.9486539668049992e6*x .- 1.9622241946502575e6*x.^2 - 878106.3537953914*x.^3 .- 147347.79216010476*x.^4
end
ytest = equat(I0_data);
I think you need to switch between I0_data
and U0_data
as the arguments usally go x = p(y) and you want to fit polynomial over y input value with x output value.
It helped, thank you!