I am working on the ContourPlot to creat contour line of a InterpolatingFunction recently. This is my data.
This is my simple code:
Get["C:\\Users\\Administrator\\Desktop\\data.mx"]
hx = Derivative[1, 0][mdfun];
hxxx = Derivative[3, 0][mdfun];
scaledA[d_, B_, k_, e_, hx_, h_, hxxx_] := (3*d*(1 + B*k)*hx)/((k + h + B*k*h)^3*e) + 3*1/e*hxxx + 3*1/e*hx;
A = scaledA[-1, 1, 0.1, 0.05, hx[x, 11.35], mdfun[x, 11.35], hxxx[x, 11.35]];
scaledϕ[A_, z_, h_, B_, k_, hx_, e_, m_] := A*(z^3/6 - (h*z^2)/2) -
m ((1 +B*k)*k*hx*z^2)/((k + h + B k h)^2*e);
sl = ContourPlot[scaledϕ[A, y, mdfun[x, 11.35], 1, 0.1, hx[x, 11.35], 0.05, -5],
{x, 0, 2*Sqrt[2] π}, {y, 0, mdfun[x, 11.35]},
RegionFunction -> Function[{x, y, z}, 0 <= y <= mdfun[x, 11.35]],
ImageSize -> 600, Contours -> 20, PlotPoints -> 100,
ContourShading -> None,
ContourStyle -> Directive[Black, Thin], Frame -> False]
I got a graph with zigzag curve.
I have tried to increase PlotPoints up to 100, MaxRecursion up to 6 (which has turned off my machine :) ), and PrecisionGoal up to 10 (which is less than the PrecisionGoal(40) of my InterpolatingFunction) that run away rather easy :P, and also PerformanceGoal->"Quality". However, by anyway, I can not get an acceptable plot. Is there any way to improve the quality of ContourPlot? Is there any possible to use filter?



PlotPoints -> 100deleted, I still am waiting for a result. – bbgodfrey Dec 20 '14 at 17:24Contours -> 20rather than specifying any value to my function, so it take about 50s in my common PC to generate the contour evenPlotPoints -> 100. Please feel free to test it :). – Enter Dec 21 '14 at 02:22InterpolatingFunction? As bbgodfrey's answer shows, the oscillations are inherent in theInterpolatingFunction, and it's quite possible that adjusting the parameters ofInterpolationcould solve the problem, but to do that we would need the original data. – Dec 21 '14 at 03:51ContourPlotin the original post, I have checked OP with the data link again, it takes 51.79 seconds to generate the contour line. My machine: i5-3470 CPU@ 3.2 GHz, RAM 4G, MMA9.0. – Enter Dec 21 '14 at 04:19InterpolatingFunctionthat ismdfun[x,t]a function of x and t, which is obtained by solved a PDE using NDSlove. It is the original data. You can export and import the data you want, say,origplot =Plot[mdfun[x, 11.35], {x, 0, 2*Sqrt[2] \[Pi]}, PlotRange -> {{0, 2*Sqrt[2] \[Pi]}, {0, 1.1}}], data = Cases[origplot, Line[data_] :> data, -4, 1][[1]]; Export["11.35.txt", data, "Table"] (change to .dat before import). In my contour, I just want to usemdfun[x,t]and its derivatives at a instant. – Enter Dec 21 '14 at 04:25hxxxoscillates rapidly at both small and largex, perhaps becausemdfundoes not have quite enough accuracy there to support three derivatives. – bbgodfrey Dec 21 '14 at 06:03FitPolynomial[data_] := Fit[data, Table[x^n, {n, 0, 10}], x]to smooth my data? – Enter Dec 21 '14 at 06:24mdfun[x, 11.35]be incorporated into anInterpolatingFunctionwithInterpolationOrdergreater than the default value of3, perhaps5to see what happens. Good night for now. – bbgodfrey Dec 21 '14 at 06:40