From: cosimo on 29 Mar 2010 04:42 Hi everibody i'm a new matlab user... i'm looking for a little help.... i have to solve the coefficients of a quadratic surface passing through nine points of a 3X3 window (in form of a 3X3 matrix) using a linear least squares approximation in a form of A+Bx+Cy+Dx^2+Exy+Fy^2 and defining a coordinate system with its origin at the centre of the window. Can i have a quick start?! Cò.
From: John D'Errico on 29 Mar 2010 06:48 "cosimo " <cosimomartelli(a)hotmail.com> wrote in message <hopp5e$22l$1(a)fred.mathworks.com>... > Hi everibody > i'm a new matlab user... i'm looking for a little help.... > i have to solve the coefficients of a quadratic surface passing through nine points of a 3X3 window (in form of a 3X3 matrix) using a linear least squares approximation in a form of > A+Bx+Cy+Dx^2+Exy+Fy^2 > and defining a coordinate system with its origin at the centre of the window. > > Can i have a quick start?! What are the (x,y) coordinates of each point? [xc,yc] = meshgrid([-1 0 1],[-1 0 1]); We need xc and yc as column vectors though. So unroll them into column vectors. xc = xc(:); yc = yc(:); Do the same with the matrix of function values. Then call polyfitn, after you download it from the file exchange. Find it here: http://www.mathworks.com/matlabcentral/fileexchange/10065 This should get you 90% of the way there. If, as I suspect, you really need this for homework, then polyfitn won't help you at all. But then, I won't do your homework. John
|
Pages: 1 Prev: simscape problem Next: how to generate random number in a fixed range |