Obtaining a equation in two variables (x and y) from a set of data points
14 次查看(过去 30 天)
显示 更早的评论
I have a Matrix. The colums represent the X values and the rows represent the Y values and the matrix element Z represents the value at (X,Y). So, in my case, X runs from 1 to 250 and Y runs from 1 to 3500. I would like to fit an equation (I suspect that the data is going to be of high order *say 50) so maybe spline?) such that Z=f(X,Y) where Z is the matrix element
Example :
Say I choose X=10 and Y=2300 in the matrix. The matrix will have a particular value Z (say 30000) at (10,2300). Now I want to fit a equation for Z as a function of X and Y. What do I do?
0 个评论
采纳的回答
Bjorn Gustavsson
2019-11-25
What you should do depends on your objective. If you very explicitly want a function you could use spap2 (and perhaps some of its siblings). It is a least-square-fitting spline function with 2-D capabilities.
If you can do all of the function evaluations at once you might be better off with interp2 (your data seems to be on a plaid grid), or griddata, scatteredInterp, triscatteredinterp functions (the latter might give you approximately your required function output), Otherwise there is always the gridfit function on the file exchange.
HTH
6 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spline Postprocessing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!