New answers tagged

3

Use SequenceCases instead of Cases: SequenceCases[xy, {{_, a_}, p : {_, b_}, {_, c_}} /; a > b && b < c :> p] (* Out: {{4.75359, -0.999151}, {10.8845, -0.993834}, {17.2955, -0.99986}} *)


1

Simple: use FindPeaks on -xy. To avoid finding a minimum at the first or the last point, use valleys = xy[[Cases[First /@ FindPeaks[-Last /@ xy], Except[1 | Length[xy], _]]]] ListPlot[xy, Epilog -> {PointSize[Medium], Red, Point[valleys]}]


4

I think you want ActCoorX = Range[0, 12000, 500]; Partition[ActCoorX, 2, 1] {{0, 500}, {500, 1000}, {1000, 1500}, {1500, 2000}, {2000, 2500}, {2500, 3000}, {3000, 3500}, {3500, 4000}, {4000, 4500}, {4500, 5000}, {5000, 5500}, {5500, 6000}, {6000, 6500}, {6500, 7000}, {7000, 7500}, {7500, 8000}, {8000, 8500}, {8500, 9000}, {9000, 9500}, {9500, 10000}, {...


4

A simple way to interleave a list with itself is Riffle. To remove the final value, use Most. Most@Riffle[ActCoorX, ActCoorX] Updates: From your comment about Table[{x, f[x]}, {x, 0, 12000, 595}], I think you don’t need to repeat coordinates. Maybe this is what you need: Table[{x, f[x]}, {x, ActCoorX}] If you don’t want x and f[x] for the last item, then: ...


1

I think it might be worthwhile to solve this problem so that the tabulated points are symmetric about the function's maximum. To do so, we start by finding where that maximum occurs. In this case, the maximum is easily found by expection. This is demonstrated like so: With[{t = 9600}, f[x_] := E^(-((-2000 + 0.5 (-t + 2 x))^2/139392))] With[{xmax = 6800}, ...


0

Printis the wrong command, try Text: t = 9600; f[x_] := E^(-((-2000 + 0.5 (-t + 2 x))^2/139392)) HillPlot = Show[{Plot[f[x], {x, 5000, 9000}, PlotRange -> Full,PlotStyle -> {Green,Dashed}], Graphics[Table[ Text[ {x, f[x]} , {x, f[x]}] , {x, 6000, 8000, 500}]]}] If you want to display only the table try TableForm@Table[{x, f[x]}, {x, 0, 12000, 1000}]


1

I don't think your code is doing what you think it's doing. For example: ds[1, 1, "lat"] (* Missing[KeyAbsent, lat] *) ds[[2]][Min] (* -123.029 *) ds[[2]][Min, "lat"] (* Infinity *) The first one fails partly because you use lat in your dataset but "lat" in your testcoords and partly because I don't think Dataset is expecting ...


2

cϕ = SortBy[First] @ Select[Length@# == 2 &]@Join[List /@ coor, ϕvalue, 2]; ListLinePlot[cϕ] Alternatively, cϕ2 = SortBy[First][Flatten /@ Select[FreeQ[{}]]@Transpose[{coor, ϕvalue}]]; cϕ3 = SortBy[First][Flatten /@ DeleteCases[{_, {}}]@Transpose[{coor, ϕvalue}]]; cϕ == cϕ2 == cϕ3 True


5

ClearAll[f] f[l_, t_, n_] := Select[l, GreaterThan[t]@First[#] &, n] /. {} -> StringTemplate["No value > `` found"]@t Examples: lst1 = {{415., {{1, 1}, {24, 67}, {17, 83}}}, {371., {{24, 67}, {17, 83}, {3, 9}}}, {370., {{4, 7}, {24, 67}, {17, 83}}}, {365.5, {{24, 67}, {17, 83}, {5, 6}}}, {124., {{1, 1}, {17, 83}, ...


Top 50 recent answers are included