How to get polynomial function of a 3d plane of data?

2 views (last 30 days)
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

Answers (1)

Walter Roberson
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
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?
Philip
Philip on 29 Nov 2012
Hi,
Thank you very much for your help. I've managed to solve my problem. I have sucessfully imported the data into the surface fitting tool so I should be able to do whatever I want now. I originally had a text file of data representing a cube of b values which exported in a long list of data. I converted that data to a 3d Array of B values but the original format was perfect for importing into the surface fitting tool. Thanks again for you help.
Philip

Sign in to comment.

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!