VERY Nonlinear Data Fitting

I have a problem regarding the fitting of a velocity profile inside a rectangular cross-section channel. Data yielded by a LDA measurement is to be fit using the analytically gained solution of the Navier Stokes equation for this geometry, namely
c * (b^2 (1 + 4 * sum(n = 1 .. infinity, (-1)^n/an^3 * cosh(an*x/b)/cosh(an*y/b)) - y^2)
The problem here is, obviously, that my fit parameters (a, b, c) partly appear in the nonlinear terms.

4 Commenti

Andrew Newell
Andrew Newell il 8 Mar 2011
Not only is it nonlinear but you have an infinite sum. I presume you really have a finite sum with coefficients a(i), i=1:N?
Philipp
Philipp il 8 Mar 2011
No, the analytic solution indeed has an infinite sum.
To compute a profile for given parameters a, b (which are the channel dimensions) and c (which is a quotient of pressure and viscosity of the fluid), I approximate these sums by replacing them with finite ones, increasing Nmax until the difference
sum(n = 1 .. nmax + 1) - sum(n = 1, nmax)
becomes smaller than MATLAB's intrinsic exactness (i.e. 10^(-16)). However, depending on the position values for y and x (in another version of abovementioned formula), the number nmax of needed summands varies widely (from 10 to over 200).
Andrew Newell
Andrew Newell il 8 Mar 2011
What is an, then?
Philipp
Philipp il 8 Mar 2011
an = (2*n - 1)/2 * Pi
You can think of the velocity being expanded in terms of cosh(an*y/b), with different "frequencies", which are all uneven multiples of Pi/2

Accedi per commentare.

 Risposta accettata

Andrew Newell
Andrew Newell il 8 Mar 2011

2 voti

If you have the Statistics Toolbox, you could use nlinfit. If you have the Optimization Toolbox, you could do something similar to this post. If you have neither, maybe this File Exchange contribution might help.

3 Commenti

Matt Tearle
Matt Tearle il 8 Mar 2011
See answers to another similar post: http://www.mathworks.com/matlabcentral/answers/2744-how-to-apply-custom-equation-on-a-curve-and-find-unknown-parameter
Philipp
Philipp il 9 Mar 2011
Unfortunately, I have neither of these toolboxes, and am trying the ChiSquareFit tool now. Thanks so far for your help...
Philipp
Philipp il 10 Mar 2011
A little update: I now used the following procedure to solve the problem at hand, as the number of parameters made an immediate fit impossible to be conducted in a way that the determined parameters were stable.
1. I reduced the number of parameters, which was possible since the prefactor c could be eliminated by normalizing the velocities vs. their maximum for x = y = 0. Furthermore, I kept the parameter a, which is the channel width, constant - inspection of the velocity profile yielded it rather clearly.
2. I had a "while ... do" loop calculate the velocity profile over and over, considering only the error at the outmost points near the channel walls, until those were minimal. I repeated this routine until inspection yielded a good corroboration of the measured data by the calculated data.
I will try a few more improvements on my algorithm and post it here in the coming days.
Thank you for your help so far.

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by