Tag Info

New answers tagged

5

Use NonlinearModelFit and put in the best guess parameters from your Manipulate. data = {0.316228, -0.316228, 0.316228, -0.316228, 0.316228, -0.316228, 0.316228, -0.316228, 0.316228, -0.316228, 0.316228} eqn[x_] := a Sin[b x + c] nlm = NonlinearModelFit[data, eqn[x], {{a, 0.4}, {c, -1}, {b, 3.1}}, x] Plot[nlm[x] /. fit, {x, 1, 11}, Epilog -> ...


1

You can apply your transformation to your sample data and use EmpiricalDistribution on the transformed data without having to use TransformedDistribution: data = RandomVariate[ExponentialDistribution[1], 10^4]; ed = EmpiricalDistribution[data]; edtr = EmpiricalDistribution[Sqrt@data]; Plot[{CDF[ed, x], CDF[edtr, x]}, {x, 0, 4}, PlotLegends -> ...


8

First I create a set of data to simulate yours. data = RandomVariate[ExponentialDistribution[1], 10^4]; Now you can take advantage of the EmpiricalDistribution function to define a model-free distribution based on your data. edist = EmpiricalDistribution[data]; The core of what you are asking for is to obtain a TransformedDistribution, i.e starting ...


0

If you frequently reorder the columns, you could do something like: tbl = {{"colNbr", "ColStr", "ColDate"}, {1, "1", "1/11/11"}, {2, "2", "2/12/12"}}; fNbr[n_] := n^2 fStr[s_] := s <> "joined" fDate[d_] := dodate[d] hdrs = {"ColDate", "colNbr", "ColStr"}; funcs = {fDate, fNbr, fStr}; funcsReordered = First /@ Extract[funcs, Position[hdrs, #] & /@ ...


2

Since v9 (if I recall) you can use MapAt with Span for such things: sample = {{"Sample", "Data", "creationdate", "othervariable"}, {2.3, 4.3, "20141008125809", 8.4}, {3.2, 1.3, "20141008125809", 9.2}, {3.2, 1.3, "20141008125809", 11.84}}; MapAt[fixDate, sample, {2 ;;, 3}] {{"Sample", "Data", "creationdate", "othervariable"}, {2.3, 4.3, ...


3

Even if there is some kind of mistake (typo) the solution is to use WhenEvent with Sow and Reap: {sol, {pts}} = Reap@NDSolve[{x''[t] == x[t]/(2*Sqrt[x[t]^2 + (1 - y[t])^2]), y''[t] == -0.2 - (1 - y[t])/Sqrt[x[t]^2 + (1 - y[t])^2], x[0] == x'[0] == Pi/3, y[0] == y'[0] == 0.5, WhenEvent[y[t] == 0 && y'[t] > 0, Sow[{t, x[t]}]]}, ...


1

A little integer and string hacking generates all and only the names required. Data = Table[s = ToString[j]; Import["C:\\Dropbox\\Sims\\datafile." <> StringTake[s, 2] <> "." <> StringDrop[s, 2] <> ".out", "Data"], {j, 200000, 300000, 1000}]


1

You could also use: data= Import["c:\\dropbox\\sims\\datafile.20." <> IntegerString[#, 10, 4] <> ".out" ]& /@ Range[1000]


3

You can use FileNames to get list of .out files data = Import[#, "Data"] &/@ FileNames["datafile.*.out", "C:\\Dropbox\\Sims\\", 1]


2

Show[ ListPlot[#, DataRange -> {0, 6 Pi}, PlotTheme -> "Detailed", PlotStyle -> PointSize[Tiny]], ListLinePlot[ MovingMap[Mean, #, {{250}, Center}, 0], PlotStyle -> {Thick, Blue}, DataRange -> {0, 6 Pi}]] & [Table[Cos[x] + RandomReal[{-1, 1}], {x, 0, 6 Pi, 0.01}]]


4

Mathematica 10 has new interesting functions for irregularly spaced data like MovingMap data = RandomReal[1, {1000, 2}]; ListLinePlot[MovingMap[Mean, data, {{0.1}}]]


1

Use Part (mat = Array[a, {4, 7}]) // MatrixForm (mat12 = mat[[All, {1, 2}]]) // MatrixForm (mat13 = mat[[All, {1, 3}]]) // MatrixForm


1

Since you say picking up the columns is your only problem, I will assume you know how to import your data into Mathematica as an array and have it in this form. data = {{0., 0.00763266, 0.0157101, 0., -0.10003, 0.0485991, 0.}, {2., 0.00489483, 0.0167661, 0., -0.106755, 0.0311657, 0.}, {4., 0.00201832, 0.0173491, 0., -0.110466, 0.0128487, 0.}, ...



Top 50 recent answers are included