-2

can not fit the curve peak:click see the fig

    data= {{-40,5},{-30,5},{-20,10},{-15,20},{-13,25},
        {-10,27},{-7,45},{-2,70},{-1,120},{0,220},
        {1,300},{2,330},{4,300},{6,270},{7,250},
         {10,150},{11,100},{12,60},{16,50},{17,45},
         {20,30},{21,25},{22,23},{25,15},{40,10},{50,5}}        (*data*)

  model=165 Exp[a^2/b^2/4.-x/b/c]Erfc[a/b/2-x/a/c]+d          (*Fitting model)      


  fit= FindFit[data,model,{{a,1.5},{b,4.},{c,5.},{d,20.}},x]   (* Fitting process*)
  d+165 Exp[0.25a^2/b^2-x/b/c] Erfc[a/(2 b)-x/(a c)]
  {a->0.529679,b->3.40937,c->2.64714,d->28.4233}                (* get the results*)


  modelf =Function[{x},Evaluate[model/.fit]]
  Function[{x},28.4233+165Exp[0.00603416-0.110802 x] Erfc[0.0776799-0.713199 x]]  (found the eqution)

  Plot[Function[{x},28.423306055448116`+165Exp[0.0060341638213215`-0.11080238519843215`x ]Erfc[0.07767988041521112`-0.7131987369585024`x  ]][x],{x,-40.774,50},Epilog?Map[Point,data],Frame->True,PlotRange->{-50,400},AxesStyleWhite]  (*Plot  result*)
Le jin
  • 3

1 Answers1

-1

It looks like it should be a parabola. Why are you using EXP{} ? (Or is that the program's SSE function?) I'd put the data into Excel , insert a scatterplot, and choose the 'trendline' function as a 2nd order polynomial, and click to show the equation and R² on the chart, so you have a correct reference. But also review the SSE method; you can enter X's and Y's, then the X²s and Y²s, and run the sums (Hence "SUM of squares of errors") The advantage is that you can choose the function you want from X to Y (f(x)), and the SSE will minimize the coefficients.

  • Yes. the curve looks like a parabola. I use EXP and Erfc because of physical process . I 'm not familiar with SSE method you mentioned,but once I get the result ,I'll response you. Thanks – Le jin Sep 29 '17 at 23:57
  • Review the formula for a linear regression, and the least-squares If you put your data into an Excel sheet, you DON'T have to use a linear-form equation, because you are reducing the errors. You can use ANY function for your Y-values, including TRIG functions, and you still can reduce the Sum of the Squares of the Errors, and get the minimal coefficients for the function YOU defined. The variance and errors will be greater for functions that clearly don't fit your data, but what IF your data are not parabolic, but a catenary or a trigonometric function within a narrow Range and Domain? – George Bxxxxxxx Nov 01 '17 at 17:24