Message Boards Message Boards

GROUPS:

FindFit for a specific line from a ContourPlot?

Posted 4 months ago
332 Views
|
1 Reply
|
0 Total Likes
|

Hi!

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

Attachments:

Vasileios,

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 = 
 Show[ContourPlot[
    Simplify[
     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]]

Regards,

Neil

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract