From: Matt J on
"Fran " <fp04(a)ic.ac.uk> wrote in message <ho13l2$m42$1(a)fred.mathworks.com>...
> Unfortunately I need the fitting to be relatively quick - I will be utilising the code in an optimisation loop with (probably) hundreds of iterations.
>
> I would find it very surprising if this kind of thing wasn't out there, somewhere, already. I think it wold be such a common problem!
>
> Thanks for your help, using a for loop will be the first place I start if nothing else becomes available from this thread! :)
=================

If you're still convinced you need this, in spite of the comments above, one way to go would be to convert the 1D fitting operator to matrix form, which we know MATLAB can manipulate very fast.

Namely, if your surface samples form an NxN matrix A, you would fit each column of
eye(N) resulting in corresponding columns of a matrix K. The 2D fit would then be given by

result=(K*(K*A).').'


and you could reuse K in each iteration of your optimization loop.
From: Rune Allnor on
On 20 Mar, 09:23, "Bruno Luong" <b.lu...(a)fogale.findmycountry> wrote:

> orthogonal polynomials are a requirement on a selected basis of a subspace.

Wrong.

Orthogonal bases are simpler or more convenient to deal with
than non-orthogonal bases, but there are no requirements anywhere
that any one basis needs to be orthogonal. Once you have a
vector space, you can choose to deal with any bais you want,
orthgonal or not. The key property to look out for, is whether
or not the basis is complete.

Rune
From: Matt J on
Rune Allnor <allnor(a)tele.ntnu.no> wrote in message <3bb7e6cd-8320-47a2-8acf-c4749762fa3c(a)g10g2000yqh.googlegroups.com>...

> Orthogonal bases are simpler or more convenient to deal with
> than non-orthogonal bases, but there are no requirements anywhere
> that any one basis needs to be orthogonal. Once you have a
> vector space, you can choose to deal with any bais you want,
> orthgonal or not. The key property to look out for, is whether
> or not the basis is complete.

Completeness isn't the only consideration. There are numerical considerations as well.
For example, the basis 1,x,x^2,x^3, is a complete basis for the space of cubic polynomials, but it is more numerically stable to fit using orthogonal polynomials.
From: Bruno Luong on
Rune Allnor <allnor(a)tele.ntnu.no> wrote in message <3bb7e6cd-8320-47a2-8acf-c4749762fa3c(a)g10g2000yqh.googlegroups.com>...
> On 20 Mar, 09:23, "Bruno Luong" <b.lu...(a)fogale.findmycountry> wrote:
>
> > orthogonal polynomials are a requirement on a selected basis of a subspace.
>
> Wrong.
>

I think you just miss-understood what I wrote.

Bruno
From: Rune Allnor on
On 20 Mar, 19:01, "Bruno Luong" <b.lu...(a)fogale.findmycountry> wrote:
> Rune Allnor <all...(a)tele.ntnu.no> wrote in message <3bb7e6cd-8320-47a2-8acf-c4749762f...(a)g10g2000yqh.googlegroups.com>...
> > On 20 Mar, 09:23, "Bruno Luong" <b.lu...(a)fogale.findmycountry> wrote:
>
> > > orthogonal polynomials are a requirement on a selected basis of a subspace.
>
> > Wrong.
>
> I think you just miss-understood what I wrote.

No, I don't. I already *know* what you mean, so I don't have
to *read* your posts. Sounds familiar?

Rune