Tag Info

Hot answers tagged

17

I always use TimeSeries for these kinds of problems, since it avoids having to worry about indices too much, gives you good control over resampling and you have a whole load of useful functions dt = 0.05; {ts1, ts2} = TimeSeries[TimeSeriesResample[#, dt, ResamplingMethod -> {"Interpolation", InterpolationOrder -> 1}]] & /@ {data1, data2}; ...


9

Because data1 and data2 have an extra set of curly brackets, it is necessary to remove the extra set before generating interpolating functions. int1 = Interpolation[Flatten[data1, 1]]; int2 = Interpolation[Flatten[data2, 1]]; The difference then can be computed and plotted: Plot[{int1[t], int2[t + .35], int1[t] - int2[t + .35]}, {t, 1105, 1134}] The ...


7

Using the same variable names. The separation can be approximated using FindPeaks. I have used on the distinctive three middle peaks. lp1 = ListPlot[data1, Epilog -> {Red, PointSize[0.03], Point@(p1 = Extract[data1[[1]], List /@ FindPeaks[data1[[1, All, 2]]][[All, 1]]])}, Frame -> True, ImageSize -> 400]; lp2 = ...


7

This seems to be a perfect candidate for DifferentiatorFilter: t = TimeSeries[l1[[All, 2]], {l1[[All, 1]]}] d = DifferentiatorFilter[t, .01]; ListLinePlot[d] I just had to adjust the cutoff frequency to weed out the fast oscillations. However, this filter scales the output differently for different cutoff frequencies. Unfortunately, I believe the ...


6

Signal-processing is not one of my strengths, but I think we used to use low-pass filters to remove such noise. It seems to work here: l2 = LowpassFilter[TimeSeries[l1], .05]; ifn = Interpolation[l2]; plot1 = Plot[Evaluate@Interpolation[l1]'[x], {x, 0, 0.5}, PlotStyle -> {Gray}]; plot2 = Plot[Evaluate@ifn'[x], {x, 0, 0.5}, PlotStyle -> {Red}]; ...


5

Finding the intersections You can use use Graphics`Mesh`FindIntersections (see Implementation of Balaban's Line intersection algorithm in Mathematica for example) either on the plot or on the points stored in the InterpolatingFunctions in sol: With curvatureConst = -3.5; there are five points of intersection: Here are the two methods: ...


5

The most important information is that you used your function ff inside another NIntegrate, because this is the source of confusion. What you have to know is that NIntegrate doesn't start right away with the numerical calculation when you call NIntegrate[ff[ξ]*ξ, {ξ, 0, 3}] It will try to do some analysis of your integrand and most likely, it will try to ...


4

I will expand on Szabolcs's answer. Starting with the same triangulation, we can see that the problematic cells consist of "triangle" whose vertices are collinear. These have areas that are either negative (wrong orientation), zero, or nearly zero (below 2.*^-15). They arise no doubt from round-off error. I could not find any means of improving the ...


4

For curvatureConst = -2.25 the equations in the Question yield An intersection can be found from First@FindRoot[{(x[t] - x[t2]) /. sol, (y[t] - y[t2]) /. sol}, {{t, 8}, {t2, 10.5}}] (* t -> 7.8869 *) Flatten[{x[t], y[t]} /. sol /. %] (* {-0.0330813, 0.693441} *) Of course, there are multiple intersections, and which is obtained depends on the ...


4

Everthing woks out fine (in version 10 at least) if you take care of a consistent name of the integration variable. Let's repeat all steps 1) Table of data In[1]:= ttable = {{0, 2.6596 - 66.137 I}, {1/9, 2.45339 - 65.3148 I}, {2/9, 1.82053 - 62.8922 I}, {1/3, 0.720006 - 58.9982 I}, {4/9, -0.911205 - 53.8382 I}, {5/9, -3.15056 - 47.6797 I}, ...


3

You can add the options InterpolationOrder -> 2 and PlotRange -> {0.1, 110} to your ListLogLinearPlot. As all your data points start at 0, you have to remove these using Rest. ListLogLinearPlot[{Rest@FinosCA, Rest@FinosCB, Rest@FinosCC, Rest@FinosCM}, Joined -> True, AspectRatio -> 1/GoldenRatio, AxesLabel -> {"Diamentro de malla\ndel ...


3

You can get a smoother result by taking the Log before making the interpolation: loginterp[x_] = Interpolation[{Log10[#1], #2} & @@@ Rest@#, InterpolationOrder -> 2][Log10[x]] & /@ {FinosCA, FinosCB, FinosCC, FinosCM}; Show[ LogLinearPlot[Evaluate@loginterp[x], {x, FinosCA[[2, 1]], FinosCA[[-1, 1]]}], ListLogLinearPlot[{FinosCA, ...


3

You can use polynomial regression approach as suggested in this answer: lm = LinearModelFit[l1, x^Range[0, 6], x]; Plot[Evaluate@lm["Function"][x], {x, Min[l1[[;; , 1]]], Max[l1[[;; , 1]]]}, PlotStyle -> Red, Prolog -> {Gray, Point[l1]}, PlotLabel -> "Comparison of the model with original data"] ListPlot[lm["FitResiduals"], PlotRange -> ...


2

You can "reverse x axis" lst = {{5, 1}, {7, 4}, {12, 5}}; iFn0 = Interpolation[{-#[[1]], #[[2]]} & /@ lst, InterpolationOrder -> 0]; f[x_] := iFn0[-x]; f /@ {5.25, 7} (*{1, 4} *) Or the same can be achieved with: InterpolationR[l_] := Interpolation[{-#[[1]], #[[2]]} & /@ l, InterpolationOrder -> 0][-#] &; a = ...


2

I propose to use the build-in interpolating function Interpolation which is a continuous function, and then to make sampling at higher frequency : FinosCA = {{0, 0}, {0.15, 2}, {0.3, 10}, {0.6, 25}, {1.18, 50}, {2.36, 80}, {4.75, 95}, {9.5, 100}};; interpolatingFunction = Interpolation[FinosCA, InterpolationOrder -> 2]; n = 10; (* number of new ...


1

This is not an answer but rather a comment/example on @Dr.WolfgangHintze and @halirutan posts, concerning the "weird" behaviour that was observed with NIntegrate, that is localization and symbolic evaluation of the variables which may actually lead to unwanted results: Edit I'll take an even more simple example which concerns both NIntegrate and Integrate: ...


1

I'll leave the creation of a suitable Manipulate[] interface for somebody else; I'll just share a few ideas in this answer. First, here is a routine that generates a parabola through three points, represented as a B-spline: parabolicArc[pts_?MatrixQ] /; Dimensions[pts] == {3, 2} := BSplineCurve[ReplacePart[pts, 2 -> Mean[Delete[pts, 2]] + ...


1

Here is the method I was alluding to in a comment to DumpsterDoofus's answer: dat = {{0, 0}, {18, 1}, {70, 1/4}, {90, -1}, {110, 2}}; (* DumpsterDoofus's solution *) fd[x_] = Integrate[Interpolation[dat, InterpolationOrder -> 0][x], x]; {xa, ya} = Transpose[dat]; f1 = y /. First[DSolve[{y'[x] == First[ya] + Differences[ya].UnitStep[x - Most[xa]], ...



Only top voted, non community-wiki answers of a minimum length are eligible