How to get polynomial function of a 3d plane of data?
2 views (last 30 days)
Show older comments
Hi,
I have a 3d array of coordinates x,y and z. For each of these coordinates I have assigned a magnetic flux density value B. I want to get a polynomial function of x and y for the front and back face of my 3D array? Does anyone know how I could do this? I tried to surface fitting tool but I have problems with my z input as it is 2d not 1d.
Cheers,
Philip
0 Comments
Answers (1)
Walter Roberson
on 29 Nov 2012
[x(:) y(:) ones(numel(x),1)] \ z(:)
would return a vector [m n c] best fitting z = m * x + n * y + c
7 Comments
Walter Roberson
on 29 Nov 2012
Which are the "front" and "back" face of your 3D array? Which coordinate is being held constant?
Are you indicating that you would like to include cross-terms between the x and y, or that we should exclude those?
See Also
Categories
Find more on Polynomials in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!