MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: conditions of fit parameters

  • To: mathgroup at smc.vnet.net
  • Subject: [mg65655] Re: conditions of fit parameters
  • From: "petitsun1" <r.bactavatchalou at mx.uni-saarland.de>
  • Date: Wed, 12 Apr 2006 06:00:05 -0400 (EDT)
  • References: <e17fdv$ol2$1@smc.vnet.net><e1aguo$si$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,
I will try to explain my problem explicitely:

I have first the following data:\!\({{10.24`, 12.611`}, {20.48`,
12.595`}, {40.96`, 12.557`}, {81.92`,
      12.463`}, {163.84`, 12.234`}, {327.68`, 11.773`}, {655.36`,
      11.054`}, {1310.7`, 10.191`}, {2621.4`, 9.3468`}, {5242.9`,
      8.6333`}, {10486.`, 8.0744`}, {20972.`, 7.6556`}, {41943.`,
      7.3466`}, {83886.`, 7.1146`}, {167770.`, 6.9339`}, {335540.`,
      6.7872`}, {671090.`, 6.6575`}, {1.3422`*^6, 6.5308`},
{2.6844`*^6,
      6.4072`}, {5.3687`*^6, 6.3103`}, {1.`*^7, 6.1427`},
{1.000001024`*^7,
      0.1344`}, {1.000002048`*^7, 0.17804`}, {1.000004096`*^7,
      0.29196`}, {1.000008192`*^7, 0.50528`}, {1.000016384`*^7,
      0.83546`}, {1.000032768`*^7, 1.2298`}, {1.000065536`*^7,
      1.5477`}, {1.00013107`*^7, 1.6657`}, {1.00026214`*^7,
      1.5783`}, {1.00052429`*^7, 1.3658`}, {1.0010486`*^7,
      1.1128`}, {1.0020972`*^7, 0.87569`}, {1.0041943`*^7,
      0.67967`}, {1.0083886`*^7, 0.53152`}, {1.016777`*^7,
      0.42835`}, {1.033554`*^7, 0.36402`}, {1.067109`*^7,
      0.3308`}, {1.13422`*^7, 0.32231`}, {1.26844`*^7,
      0.33302`}, {1.53687`*^7, 0.37133`}, {2.`*^7, 0.47939`}}\)

You can see that there are a discontinuity of the data points at 10^7.
I have define a function wich is the sum of 2 functions define in
differents x -axes, I mean:
The mathematica programm is following:

Needs["Statistics`Master`"]
Needs["Statistics`NonlinearFit`"]

Clear[f, Eu, Es, alpha, tau, beta, frmax, fr]
frmax = 1*10^7;
f1[fr_] :=
  Which[0 <= fr <= frmax,
    Eu1 + (Es1 -
            Eu1)*(Cos[
              beta1*ArcTan[((2*\[Pi]*fr*tau1)^(1 - alpha1))*
                    Cos[0.5*\[Pi]*
                          alpha1]/(1 + ((2*\[Pi]*fr*tau1)^(1 -
alpha1))*
                            Sin[0.5*\[Pi]*alpha1])]])
          /((1 +
                  2*((2*\[Pi]*fr*tau1)^(1 - alpha1))*
                    Sin[0.5*\[Pi]*
                        alpha1] + ((2*\[Pi]*fr*
                          tau1)^(2*(1 - alpha1))))^(beta1/2))
    , frmax < fr <=
      2*frmax, (Es1 -
          Eu1)*(Sin[
            beta1*ArcTan[((2*\[Pi]*(fr - frmax)*tau1)^(1 - alpha1))*
                  Cos[0.5*\[Pi]*
                        alpha1]/(1 + ((2*\[Pi]*(fr - frmax)*tau1)^(1 -
                                  alpha1))*Sin[0.5*\[Pi]*alpha1])]])
        /((1 +
                2*((2*\[Pi]*(fr - frmax)*tau1)^(1 - alpha1))*
                  Sin[0.5*\[Pi]*
                      alpha1] + ((2*\[Pi]*(fr - frmax)*
                        tau1)^(2*(1 - alpha1))))^(beta1/2))]

(*f2[fr_] :=
    Which[0 <= fr <= frmax,
      Eu2 + (Es2 -
              Eu2)*(Cos[
                beta2*ArcTan[((2*\[Pi]*fr*tau2)^(1alpha2))*
                      Cos[0.5*\[Pi]*
                            alpha2]/(1 + ((2*\[Pi]*fr*tau2)^(1 -
alpha2))*
                              Sin[0.5*\[Pi]*alpha2])]])
            /((1 +
                    2*((2*\[Pi]*fr*tau2)^(1 - alpha2))*
                      Sin[0.5*\[Pi]*
                          alpha2] + ((2*\[Pi]*fr*
                            tau2)^(2*(1 - alpha2))))^(beta2/2))
      , frmax < fr <=
        2*frmax, (Es2 -
            Eu2)*(Sin[
              beta2*ArcTan[((2*\[Pi]*(fr - frmax)*tau2)^(1 - alpha2))*
                    Cos[0.5*\[Pi]*
                          alpha2]/(1 + ((2*\[Pi]*(fr - frmax)*tau2)^(1
-
                                    alpha2))*Sin[0.5*\[Pi]*alpha2])]])
          /((1 +
                  2*((2*\[Pi]*(fr - frmax)*tau2)^(1 - alpha2))*
                    Sin[0.5*\[Pi]*
                        alpha2] + ((2*\[Pi]*(fr - frmax)*
                          tau2)^(2*(1 - alpha2))))^(beta2/2))]
  *)

f[fr_] := f1[fr]
p1 = ListPlot[t1, PlotStyle -> {PointSize[.02], RGBColor[0, 0, 1]}]

lsg = NonlinearRegress[ t1, f[fr],
    fr, {{Eu1, 12.6}, {Es1, 6.6}, {alpha1, 0.5}, {beta1, 0.4}, {tau1,
        0.0003}}, MaxIterations -> 300,
    RegressionReport -> {BestFit, FitResiduals, ParameterTable,
        AsymptoticCorrelationMatrix, FitCurvatureTable}, ShowProgress
-> True]



As you can see, first I have define the fnction which is a sum of
function define in different x-domain.
After, I would like to fit it with NonLinearRegress.
The Problem is that I can´t give range of the parameters which I need
to help him to fit the data points.

If you have some idea of what i can do to solve my problem, it will be
helpul..
Thanks a lot, 
Ravi


  • Prev by Date: Re: using Legend package
  • Next by Date: Re: using Legend package
  • Previous by thread: Re: conditions of fit parameters
  • Next by thread: Problem with compiled function (is this a bug?)