Message Boards Message Boards

0
|
5508 Views
|
5 Replies
|
2 Total Likes
View groups...
Share
Share this post:

FindFit built-in symbol: error doesn't make sense

Posted 11 years ago
Hello All,

Below is the code I'm using in nb file:

"In[35]:= mdl =
 R1 (1 - E^(-t/(R1 C1))) + R2 (1 - E^(-t/(R2 C2))) +
  R3 (1 - E^(-t/(R3 C3))) + R4 (1 - E^(-t/(R4 C4))) - RT Out[35]= (1 - E^(-(t/(C1 R1)))) R1 + (1 - E^(-(t/(C2 R2)))) R2 + (1 -
    E^(-(t/(C3 R3)))) R3 + (1 - E^(-(t/(C4 R4)))) R4 - RT In[37]:= RC = {R1, R2, R3, R4, C1, C2, C3, C4};
In[39]:= var = {t, RT};
In[41]:= SiCdata
Out[41]= {{{1.01307*10^-6, 0.0879593}, {2.15234*10^-6,
   0.0878413}, {3.44712*10^-6, 0.0877677}, {5.69728*10^-6,
   0.089873}, {0.0000103479, 0.0966533}, {0.0000165751,
   0.101442}, {0.0000274007, 0.111831}, {0.0000399447,
   0.117391}, {0.0000564393, 0.129449}, {0.0000797453,
   0.142746}, {0.00010581, 0.153601}, {0.000144912,
   0.182361}, {0.000192317, 0.211257}, {0.000247322,
   0.238798}, {0.0002987, 0.26996}, {0.000372205,
   0.290521}, {0.000478729, 0.344956}, {0.000635334,
   0.399615}, {0.000791905, 0.474518}, {0.00111891,
   0.523259}, {0.00139456, 0.606239}, {0.00179342,
   0.685274}, {0.00223507, 0.774655}, {0.00325897,
   0.87545}, {0.00446271, 0.989471}, {0.0061115,
   1.14619}, {0.00810842, 1.20338}, {0.0121984, 1.29461}, {0.0167028,
   1.42766}, {0.024351, 1.53597}, {0.0402465, 1.57282}, {0.0686447,
   1.65056}, {0.100056, 1.64945}, {0.155293, 1.64816}, {0.256644,
   1.64669}, {0.496278, 1.68571}, {0.746443, 1.68449}, {1.12279,
   1.72519}, {1.44341, 1.72441}, {1.97584, 1.72345}}}
In[43]:= fit = FindFit[SiCdata, mdl, RC, var];




And below is the errorDuring evaluation of In[43]:= FindFit::fitd: First argument {{{1.01307*10^-6,0.0879593},{2.15234*10^-6,0.0878413},{3.44712*10^-6,0.0877677},{5.69728*10^-6,0.089873},{0.0000103479,0.0966533},{0.0000165751,0.101442},{0.0000274007,0.111831},{0.0000399447,0.117391},{0.0000564393,0.129449},{0.0000797453,0.142746},{0.00010581,0.153601},{0.000144912,0.182361},<<16>>,{0.0167028,1.42766},{0.024351,1.53597},{0.0402465,1.57282},{0.0686447,1.65056},{0.100056,1.64945},{0.155293,1.64816},{0.256644,1.64669},{0.496278,1.68571},{0.746443,1.68449},{1.12279,1.72519},{1.44341,1.72441},{1.97584,1.72345}}} in FindFit is not a list or a rectangular array. >>
During evaluation of In[43]:= FindFit::fitd: First argument {{{1.01307*10^-6,0.0879593},{2.15234*10^-6,0.0878413},{3.44712*10^-6,0.0877677},{5.69728*10^-6,0.089873},{0.0000103479,0.0966533},{0.0000165751,0.101442},{0.0000274007,0.111831},{0.0000399447,0.117391},{0.0000564393,0.129449},{0.0000797453,0.142746},{0.00010581,0.153601},{0.000144912,0.182361},<<16>>,{0.0167028,1.42766},{0.024351,1.53597},{0.0402465,1.57282},{0.0686447,1.65056},{0.100056,1.64945},{0.155293,1.64816},{0.256644,1.64669},{0.496278,1.68571},{0.746443,1.68449},{1.12279,1.72519},{1.44341,1.72441},{1.97584,1.72345}}} in FindFit is not a list or a rectangular array. >>

It's definitely an array but why it's throwing problem.

Please help!!
POSTED BY: Ram K
5 Replies
Posted 11 years ago
 In[1]:= mdl = R1(1-E^(-t/(R1 C1)))+R2(1-E^(-t/(R2 C2)))+R3(1-E^(-t/(R3 C3)))+R4(1-E^(-t/(R4 C4)));
  RC = {R1, R2, R3, R4, C1, C2, C3, C4};
  var = {t};
 SiCdata = {{1.01307*10^-6, 0.0879593}, {2.15234*10^-6, 0.0878413}, {3.44712*10^-6, 0.0877677},
  {5.69728*10^-6, 0.089873}, {0.0000103479, 0.0966533}, {0.0000165751, 0.101442},
  {0.0000274007, 0.111831}, {0.0000399447, 0.117391}, {0.0000564393, 0.129449},
  {0.0000797453, 0.142746}, {0.00010581, 0.153601}, {0.000144912, 0.182361},
  {0.000192317, 0.211257}, {0.000247322, 0.238798}, {0.0002987, 0.26996},
  {0.000372205, 0.290521}, {0.000478729, 0.344956}, {0.000635334, 0.399615},
{0.000791905, 0.474518}, {0.00111891, 0.523259}, {0.00139456, 0.606239},
{0.00179342, 0.685274}, {0.00223507, 0.774655}, {0.00325897, 0.87545},
{0.00446271, 0.989471}, {0.0061115, 1.14619}, {0.00810842, 1.20338},
{0.0121984, 1.29461}, {0.0167028, 1.42766}, {0.024351, 1.53597},
{0.0402465, 1.57282}, {0.0686447, 1.65056}, {0.100056, 1.64945},
{0.155293, 1.64816}, {0.256644, 1.64669}, {0.496278, 1.68571},
{0.746443, 1.68449}, {1.12279, 1.72519}, {1.44341, 1.72441}, {1.97584, 1.72345}};
{R1,R2,R3,R4,C1,C2,C3,C4}={R1,R2,R3,R4,C1,C2,C3,C4}/.FindFit[SiCdata, mdl, RC, var]

Out[4]= {0.113212, 0.607843, 0.915153, 0.097722, 5.76688, 0.00204947, 0.011857, 5.09314*10^-6}

In[5]:= Show[ListPlot[SiCdata, PlotRange -> All], Plot[mdl, {t, 0, 2}, PlotRange -> {{0, 2}, {0, 1.75}}]]

Out[5]= ...PlotSnipped...
Make small changes one at a time and verify that it still works after each change as you try to get it to be what you need it to be.
POSTED BY: Bill Simpson
Posted 11 years ago
Thanks Bill! It seems to be working! I'll ask any question on this same page if i get stuck.
For time being, consider this to be resolved. 

Thanks Bill and Illlian! You've been so helpful!
POSTED BY: Ram K
The data may be an array, but it is not a rectangular array -- there is an extra level of List.

Furthermore, if there are two variables, then the data should be a list of triples.
POSTED BY: Ilian Gachevski
Posted 11 years ago
Thanks Ilian! So, how should i resolve that? Please help!
POSTED BY: Ram K
Hello and welcome to the Wolfram Community! Please take a few minutes to read this tutorial about correct posting – especially of Mathematica code:

How to type up a post: editor tutorial & general tips

If you will not follow the tutorial, other members of community may not be able to test your code. To edit your post – click “Edit” in the lower right corner of your post. You can also attach a notebook.
POSTED BY: EDITORIAL BOARD
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