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 -> 100
deleted, I still am waiting for a result. $\endgroup$Contours -> 20
rather 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 :). $\endgroup$InterpolatingFunction
? As bbgodfrey's answer shows, the oscillations are inherent in theInterpolatingFunction
, and it's quite possible that adjusting the parameters ofInterpolation
could solve the problem, but to do that we would need the original data. $\endgroup$ContourPlot
in 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. $\endgroup$