1
$\begingroup$

I want to plot the graph in this picture, but I don't know formula of the function. I tried

 f[x_] := a x^9 + b x^8 + c x^7 + d x^6 + e x^5 + n x^4 + g x^3 + 
   h x^2 + k x + l ;
NSolve[{f[-2] == -2, f[2] == 2, f[4] == 4, f[0] == 6, f[1.5] == 3, 
  f'[0] == 0, f'[2.5] == 0, f'[1.5] == 0, f[2.5] == 1.5, 
  f'[1.2] == 0}, {a, b, c, d, e, n, g, h, k, l}, Reals]

I got

{{a -> 0.23626, b -> -2.61292, c -> 9.81292, d -> -9.83145, e -> -26.1737, n -> 76.7269, g -> -67.1827, h -> 16.1222, k -> 0., l -> 6.}}

But the result don't exactly.

How can I find formula of the function of this graph?

enter image description here

$\endgroup$
1
  • $\begingroup$ What are your thoughts about the inflexion point within $(1,2)$? $\endgroup$ Sep 9, 2017 at 8:01

1 Answer 1

8
$\begingroup$

We can extract the data from the picture ,then use the "FindFormula" to find formula of the function.(It is difficult to extract data directly through image processing, so I erased interference in the picture firstly) .

enter image description here

imgdat = Sort[ImageValuePositions[Thinning@ColorNegate@Binarize[IMG], 1]];
dat = ({Rescale[#1, MinMax[imgdat[[;; , 1]]], {-2.1, 4.4}], Rescale[#2, MinMax[imgdat[[;; , 2]]], {-2.7, 6.4}]} & @@@ imgdat);
fits = FindFormula[dat, x, 1, "Score" ]
Show[ListPlot[dat], 
 Plot[First@fits, {x, -2.1, 4.4}, PlotRange -> All, 
  PlotStyle -> Directive[Red, Thick]], AspectRatio -> 1]

enter image description here

maybe help.

$\endgroup$
9
  • $\begingroup$ Another approach is used here mapleprimes.com/questions/… . $\endgroup$
    – user64494
    Sep 9, 2017 at 18:27
  • $\begingroup$ @jiaoeyuhushu Where can I put my picture? $\endgroup$ Sep 10, 2017 at 7:38
  • $\begingroup$ If my picture has name is pic.PNG, how to put it in your code? $\endgroup$ Sep 10, 2017 at 8:36
  • $\begingroup$ @toandhsp RemoveAlphaChannel[pic.PNG] or Save as pic.JPG $\endgroup$ Sep 10, 2017 at 9:41
  • $\begingroup$ How I input pic.JPG? Where the command contain pic.JPG? $\endgroup$ Sep 10, 2017 at 9:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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