home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: sci.optics
- Path: sparky!uunet!stanford.edu!EE.Stanford.EDU!siegman
- From: siegman@EE.Stanford.EDU (Anthony E. Siegman)
- Subject: Re: Zernike fitting routine (wanted)
- Message-ID: <1992Nov23.182731.2742@EE.Stanford.EDU>
- Keywords: zernike, curve fitting
- Organization: Stanford University
- References: <a1pq!v#@lynx.unm.edu>
- Date: Mon, 23 Nov 92 18:27:31 GMT
- Lines: 27
-
- >I am looking for a routine to fit Zernike polynomials to data on a grid,
- >perferably with sources and *documentation*. Does anyone have such a
- >critter that they might share with me? Fortran or C are both cool.
-
- 1) Zernike polynomials are not built into Mathematica, but could be
- easily added; and then the "Fit" routine that is in Mathematica could
- be used to fit data to these polynomials as a basis set. This routine
- is remarkably good.
-
- 2) In addition, given below is a "SimpleFit" routine which is a subset
- of "Fit" supplied to me by somefrom from Wolfram Research, which is
- even more useful in that it returns the list of coefficients for the
- expansion of "data" in terms of the "basis" functions and the
- "variables". The syntax is more or less like "Fit".
-
-
- SimpleFit[data_, basis_, vars_] :=
- Block[{purebasis, designmatrix, designinverse, response,
- fitcoefficients},
- purebasis = Function[Evaluate[vars], Evaluate[basis]];
- designmatrix = Apply[purebasis, data, 1];
- designinverse = PseudoInverse[designmatrix];
- response = Last /@ data;
- fitcoefficients = designinverse . response;
- fitcoefficients
- ]
-
-