Tag Info

New answers tagged

3

I would use the new associations functions. letters = {a, b, c, d, e, f, g}; groups = {{a, b, c, d}, {e, f, g, h}}; asc = Counts[letters] (* <|a -> 1, b -> 1, c -> 1, d -> 1, e -> 1, f -> 1, g -> 1|> *) Total /@ DeleteMissing /@ Map[asc, groups, {2}] This should be fast assuming that letters is large and groups is small ...


2

bins = {{a, b, c, d}, {e, f, g, h}}; vals = {1, 2}; ruls = Flatten@MapThread[Thread[Rule@##] &, {bins, vals}]; set = {a, b, e, e, f}; BinCounts[set /. ruls, {0, 6, 1}] (* {0, 2, 3, 0, 0, 0}*) If you always want vals going from 1 to Length@bins, then you can do instead: fun = Function[{r}, Position[bins, r][[1, 1]], Listable]; BinCounts[fun@set, {0, ...


6

One can use FindMinimum and an objective function to find parameters that minimize the fit between the data and reconstructed data (i.e., forward model) provided one has equations for the forward model. This will be a bit long winded but here goes. Step 1. Define the model We will assume that the capacitor is a linear function of the finger data (you are ...


1

Another possibility, which avoids interpolation, is the usage of DerivativeFilter, in particular to take the second derivative: {x, y} = Transpose@ data; d2y = DerivativeFilter[y, {2}]; kinkx = First@ Pick[data, d2y, Min[d2y]]; The result is: {45,2.793872376}


8

You pose a two part question: Part 1 find the "C's" from omega and J: Cmatrix = ({{C1 + CJ + CJ, -CJ, 0, -CJ}, {-CJ, C2 + CJ + CJ, -CJ, 0}, {0, -CJ, C1 + CJ + CJ, -CJ}, {-CJ, 0, -CJ, C2 + CJ + CJ}}); InvCmat = Inverse[Cmatrix]; L = 1.84 \[Omega]1 = Sqrt[1/L InvCmat[[1, 1]]]; \[Omega]2 = Sqrt[1/L InvCmat[[2, 2]]]; J = 1/2 InvCmat[[1, 2]]/ ...


2

I can unfortunately not just comment because I lack the reputation, which I would have found more appropriate. This case, to me, seems more like a question of actual fitting than the programing so I'll give you a few ideas that I had. First of all, it could be useful to have analytic expressions for the invcmat elements. This has a simple reason. If those ...


4

Create an interpolating function from your data: fi = Interpolation@data How the interpolating function looks: Plot[fi@x, {x, 35.5, 49}] Plot the gradient of the gradient fi'' of the interpolating function: Plot[fi''@x, {x, 35.5, 49}] Select those values where the 2nd differential is relatively large: Select[{fi''[First@#], First@#} & /@ ...


6

Sometimes, a linear interpolation is sufficient and setting InterpolationOrder->1 can avoid over/under-shoots in the interpolated function. EDIT You can also use an auxiliary function made to keep the values non-negative while keeping a sort of smoothness: ClearAll[keepPositive]; Attributes[keepPositive] = {Listable}; keepPositive[x_] := ...


2

Works if dates aren't sequential days: Data2 = Thread[{t + QuantityMagnitude@DateDifference[Data[[1, 1]], #] & /@ Data[[All, 1]], Data[[All, 2]]}] (Not sure if that's what you were going for, if not...) Data2 = Thread[{t + Range[0, Length@Data - 1], Data[[All, 2]]}]


2

Data2=MapThread[{t + #1, Last@#2} &, {Range[0, Length@Data - 1], Data}] {{t, 49.9061}, {1 + t, 50.3395}, {2 + t, 50.7569}, {3 + t, 50.7649}, {4 + t, 50.2432}, {5 + t, 49.256}, {6 + t, 49.2801}, {7 + t, 49.4486}, {8 + t, 49.264}, {9 + t, 49.4647}, {10 + t, 49.561}, {11 + t, 49.9944}}


1

Here is my solution. After recording the snippets and background using SystemDialogInput["RecordSound"], send the sound objects through a BandpassFilter to restrict to voice frequencies only: background = BandpassFilter[background, {300, 3400}]; sn1 = BandpassFilter[sn1, {300, 3400}]; sn2 = BandpassFilter[sn2, {300, 3400}]; Then we can see if the ...


1

It is just ListPlot[Flatten[data], Joined -> True, PlotStyle -> {Black, Dashed}, PlotRange -> All, DataRange -> {0, 1000}, Frame -> True, FrameLabel -> {"Zone", "Force"}] EDIT: Oh like it was mentioned in the comments. :)



Top 50 recent answers are included