Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- In[171]:= Needs["ErrorBarPlots`"];
- data = Import[
- "C:\\Users\\User\\Documents\\DELETE\\Coil_DataWU.csv", "CSV"];
- data = data /. s_String :> ToExpression[s]
- values = ImportString["0 0.37 0.04444 0.002
- 0.014 0.36 0.04432 0.002
- 0.023 0.35 0.0442 0.002
- 0.031 0.32 0.04384 0.002
- 0.0343 0.3 0.0436 0.002
- 0.0395 0.28 0.04336 0.002
- 0.0436 0.27 0.04324 0.002
- 0.0469 0.25 0.043 0.002
- 0.0501 0.24 0.04288 0.002
- 0.0549 0.21 0.04252 0.002
- 0.0599 0.19 0.04228 0.002
- 0.0667 0.14 0.04168 0.002
- 0.0735 0.12 0.04144 0.002
- 0.0808 0.11 0.04132 0.002
- 0.086 0.09 0.04108 0.002
- 0.0912 0.08 0.04096 0.002
- 0.097 0.06 0.04072 0.002
- 0.1041 0.05 0.0406 0.002
- 0.1123 0.04 0.04048 0.002
- 0.1203 0.03 0.04036 0.002
- 0.1289 0.03 0.04036 0.002
- 0.1365 0.02 0.04024 0.002
- 0.1408 0.01 0.04012 0.002
- 0.156 0.0048 0.0004576 0.002
- 0.1625 0.0038 0.0004456 0.002
- 0.1716 0.0031 0.0004372 0.002
- 0.1783 0.0024 0.0004288 0.002
- 0.1878 0.0018 0.0004216 0.002
- 0.1975 0.0015 0.000418 0.002
- 0.2052 0.0013 0.0004156 0.002
- 0.2104 0.0011 0.0004132 0.002
- 0.2183 0.0009 0.0004108 0.002
- 0.2262 0.0007 0.0004084 0.002
- 0.2336 0.0006 0.0004072 0.002
- 0.2412 0.0005 0.000406 0.002
- 0.2479 0.0004 0.0004048 0.002
- 0.254 0.0004 0.0004048 0.002
- 0.261 0.0003 0.0004036 0.002
- 0.2659 0.0003 0.0004036 0.002
- 0.2709 0.0003 0.0004036 0.002
- 0.2776 0.0002 0.0004024 0.002
- 0.2812 0.0002 0.0004024 0.002
- 0.295 0.0002 0.0004024 0.002
- 0.3015 0.0001 0.0004012 0.002
- 0.3073 0.0001 0.0004012 0.002
- 0.3125 0.0001 0.0004012 0.002
- 0.3185 0.0001 0.0004012 0.002
- 0.3229 0.0001 0.0004012 0.002
- 0.3322 0.0001 0.0004012 0.002
- 0.341 0 0.0004 0.002"];
- mu = 4 e - 7*Pi;
- Radius = 0.149;
- radius = 0.0582;
- frequency = 8313;
- field [r_?NumericQ, x_?NumericQ, mu_?NumericQ, Radius_?NumericQ,
- frequency_?NumericQ] :=
- mu*frequency*
- Sqrt[2]/(2*Pi*
- Sqrt[x^2 + (Radius + r)^2])*((Radius^2 - x^2 -
- r^2)/(x^2 + (r - Radius)^2)*
- EllipticE[Sqrt[4*r*Radius*(x^2 + (Radius + r)^2)^(-1)]] +
- EllipticK[Sqrt[4*r*Radius*(x^2 + (Radius + r)^2)^(-1)]]);
- solution =
- FindFit[data,
- 2*i*Pi*Integrate[{field[r, x, mu, Radius, frequency]}, {r, 0,
- radius}], {{i, .7}}, x];
- Out[173]= {{0, 0.37}, {0.014, 0.36}, {0.023, 0.35}, {0.031,
- 0.32}, {0.0343, 0.3}, {0.0395, 0.28}, {0.0436, 0.27}, {0.0469,
- 0.25}, {0.0501, 0.24}, {0.0549, 0.21}, {0.0599, 0.19}, {0.0667,
- 0.14}, {0.0735, 0.12}, {0.0808, 0.11}, {0.086, 0.09}, {0.0912,
- 0.08}, {0.097, 0.06}, {0.1041, 0.05}, {0.1123, 0.04}, {0.1203,
- 0.03}, {0.1289, 0.03}, {0.1365, 0.02}, {0.1408, 0.01}, {0.156,
- 0.0048}, {0.1625, 0.0038}, {0.1716, 0.0031}, {0.1783,
- 0.0024}, {0.1878, 0.0018}, {0.1975, 0.0015}, {0.2052,
- 0.0013}, {0.2104, 0.0011}, {0.2183, 0.0009}, {0.2262,
- 0.0007}, {0.2336, 0.0006}, {0.2412, 0.0005}, {0.2479,
- 0.0004}, {0.254, 0.0004}, {0.261, 0.0003}, {0.2659,
- 0.0003}, {0.2709, 0.0003}, {0.2776, 0.0002}, {0.2812,
- 0.0002}, {0.295, 0.0002}, {0.3015, 0.0001}, {0.3073,
- 0.0001}, {0.3125, 0.0001}, {0.3185, 0.0001}, {0.3229,
- 0.0001}, {0.3322, 0.0001}, {0.341, 0}}
- During evaluation of In[171]:= FindFit::fitm: Unable to solve for the fit parameters; the design matrix is nonrectangular, non-numerical, or could not be inverted.
- During evaluation of In[171]:= FindFit::fitm: Unable to solve for the fit parameters; the design matrix is nonrectangular, non-numerical, or could not be inverted.
Add Comment
Please, Sign In to add comment