Message Boards Message Boards

0
|
3016 Views
|
0 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Problem in symbolic interpolation

Posted 9 years ago

Hello, everyone.

I am trying to fit one function (let's say f[t]) to experimental data. I obtained f[t] through interpolation from other experimental data where I already include fitting parameters. That is, f[t] is symbolically interpolated function. But the problem that I have now is that the fitting process takes too long time even when the fitting function looks so simple. I think that the origin of this is due to the symbolic interpolation, which looks to consume lots of time. Eventually, I have to handle more complex function with many data points. Do you have some ideas to fix or circumvent this problem ?

Or, if you think that I don't need to use interpolation for this fitting process, could you please give me some advices ?

Thank you in advance... The test code is below...

Remove["Global`*"];
DataExp = 
  Table[{j, 
    10 Exp[-(j/10)^2] + Random[Real, {-1/10, 1/10}]}, {j, -100, 100}];
FData = Fourier[DataExp[[All, 2]]];
DataRef = 
  Table[{j, 15 Exp[-(j/7)^2] + Random[Real, {-1/10, 1/10}]}, {j, -100,
     100}];
FDataRef = Fourier[DataRef[[All, 2]]];
Ti = DataExp[[1, 1]];
Tf = DataExp[[-1, 1]];
DataNum = Length[DataExp]
ListPlot[{Re[FData], Re[FDataRef]}, PlotRange -> All]
ListPlot[{DataExp, DataRef}, PlotRange -> {{-100, 100}, {-1, 10}}]
fm = (DataNum - 1)/((Tf - Ti) + 1)/2;
Atten[\[Delta]1_, \[Delta]2_, f_] = 
  Exp[-\[Delta]1 - \[Delta]2 (fm - Abs[f - fm])];
AttenData[\[Delta]1_, \[Delta]2_] = 
  Table[Atten[\[Delta]1, \[Delta]2, (j - 1)/((Tf - Ti) + 1)], {j, 1, 
    DataNum}];
EchoData[\[Delta]1_, \[Delta]2_] = 
  AttenData[\[Delta]1, \[Delta]2] FDataRef;
EchoDataI[\[Delta]1_?NumericQ, \[Delta]2_?NumericQ] := 
  InverseFourier[EchoData[\[Delta]1, \[Delta]2]];
EchoDataFRe[\[Delta]1_?NumericQ, \[Delta]2_?NumericQ] := 
  Table[{(j - 1)/((Tf - Ti) + 1), 
    Re[EchoData[\[Delta]1, \[Delta]2][[j]]]}, {j, 1, DataNum}];
EchoDataTI[\[Delta]1_?NumericQ, \[Delta]2_?NumericQ] := 
  Table[{(j - 1 - (DataNum - 1)/2)/(DataNum/(Tf - Ti + 1)), 
    Re[EchoDataI[\[Delta]1, \[Delta]2][[j]]]}, {j, 1, DataNum}];
EchoDataTIItp[\[Delta]1_?NumericQ, \[Delta]2_?NumericQ] := 
  Interpolation[EchoDataTI[\[Delta]1, \[Delta]2]];
Para = FindFit[DataExp, 
  EchoDataTIItp[0, \[Delta]2][t], {{\[Delta]2, 20}}, t, 
  MaxIterations -> 500]
POSTED BY: hwoarang Polar
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract