I have some data in a .txt file, and I'm trying to import it to Mathematica and fit it with a function. The data is a 647x647
matrix of values. This seems like it should work:
data = Import["C:\\File_path_goes_here.txt", "Table"];
curve = NonlinearModelFit[data, a*Sin[c*x + d*y + e] + b, {a, b, c, d, e}, {x,y}]
But I get the message
Number of coordinates (647) is not equal to the number of variables (2).
I know the data import works, because I can plot the data with ArrayPlot[data]
, so it must be something with the way I'm trying to do the fit. Is the "Table"
format incompatible with the NonlinearModelFit
function? If so, how do I convert it to a compatible format, or alternatively, what function should I use to fit that model with that dataset? If not, is my syntax wrong in some way? Thank you for the help!