0
$\begingroup$

I have this data making this ListPlot3D:

ListPlot3D[Flatten[trialstuff2, 1], ColorFunction -> "TemperatureMap"]

I can create an interpolation function:

intFunc = Interpolation[Join @@ trialstuff2];

I want to find the solutions to the equation intFunc == 0 as a y[x] function since it will be in 2D.

How can I do it?
I could not get Solve to work. Is there a trick to it or do I need to find the intersection between the interpolated function and a plane {x,y,0}?

$\endgroup$
3
  • $\begingroup$ Sorry I cannot load the data trialstuff. Could you please provide a small set of data? Thanks. $\endgroup$ Jun 12 '18 at 13:05
  • $\begingroup$ @UlrichNeumann I managed to import the data by changing the file extension from .txt to .m and than using just the Import function. $\endgroup$
    – Fraccalo
    Jun 12 '18 at 13:08
  • $\begingroup$ @Fraccalo: Thank you for your effort, but I cannot access the link(url)... $\endgroup$ Jun 12 '18 at 13:27
2
$\begingroup$

Try:

f0[x_] = NSolve[intFunc[x, y] == 0, y][[1]]

In this way you will obtain a function y[x] where the intFunc[x,y]==0.

For example:

(intFunc[#, y /. f0[#]]) & /@ Range[2.5, 4, 0.1] // Chop

{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}

pp0 = {#, y /. f0[#], (intFunc[#, y /. f0[#]])} & /@ Range[2.5, 4, 0.01] // Chop;        
Show[
     ListPlot3D[Flatten[trialstuff2, 1], ColorFunction -> "TemperatureMap"]
     , ListPointPlot3D[pp0]
     ]

enter image description here

And this is for showing that the intersection is actually in z=0:

Show[
 ListPlot3D[Flatten[trialstuff2, 1], ColorFunction -> "TemperatureMap"]
 , Plot3D[0, {x, 0, 5}, {y, 0, 500}, PlotStyle -> Opacity[0.5]]
 , ListPointPlot3D[pp0]
 ]

enter image description here

$\endgroup$
4
  • $\begingroup$ No it still gives no answer $\endgroup$ Jun 12 '18 at 12:58
  • $\begingroup$ @Fraccalo, not sure I understand what you propose. Why should you solve for $y$ only, instead of for $x$ and $y$? $\endgroup$
    – MarcoB
    Jun 12 '18 at 13:06
  • $\begingroup$ @MarcoB I think I misinterpreted the question. I thought the OP was about finding y[x] so that the intFunc is equal to 0. And I thought my solution provided that. For example, if we consider the toy case: a[x_] = Solve[x + y == 0, y] the result gives {{y -> -x}}, which is a y[x] that satisfies the condition of x+y ==0! $\endgroup$
    – Fraccalo
    Jun 12 '18 at 13:16
  • $\begingroup$ I'll edit the answer to make that clearer. $\endgroup$
    – Fraccalo
    Jun 12 '18 at 13:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.