Message Boards Message Boards

FindFit for a specific line from a ContourPlot?



I have been trying to find an expression u(r) for a specific line of a contourplot (the one that looks like ln(x) on the last image of the nb)

Is there a way to :

Extract data from a ContourPlot that is not one to one line (meaning for 1 x , there are at least 2 y satisfying the equation)?

FindFit for a contour plot?

Have been trying so hard and looking everything on Google with no success. Any help is appreciated since im on timetable

11 days ago


By doing only one contour you can convert it to points. You should use Normal to convert the ContourPlot format from GraphicsComplex to Graphics. Then you can extract the lines by searching for them.

For your example, I edited your example by deleting all but one contour value ({0.8}:

oneContour = 
     u^2 + d/(u*R^2)^(c - 1) - a/R + 
         b (2 (1 - R^2)/(1 - R^2 u) + (R^2 - 
                R^2 u)^2/(R^2 (1 - R^2 u)^2)) - (Bernoullifast + 
            Bernoullislow)/2 /. c -> c1[[1]] /. a -> a1[[1]] /. 
      b -> b1[[1]]], {R, 0.0, 1.0}, {u, 0.0, 3.0}, 
    ContourShading -> None, PlotPoints -> 100, Contours -> {0.8}]
   , FrameLabel -> {{HoldForm[u], None}, {HoldForm[R], None}}, 
   LabelStyle -> {GrayLevel[0]}] /. 
  Tooltip[x_, 0.028] :> Tooltip[newStyle[x], 0.028]

To get the points (and then replot them)

ListPlot[Cases[Normal[oneContour], Line[x_] :> x, Infinity]]



POSTED BY: Neil Singer
2 days ago

Group Abstract Group Abstract