0
$\begingroup$

I have a function of x1 that I can plot in the form y=f(x1). However, I have a relation y=f(x1)=f(x2), where I don't know the form of f(x2), but I can solve for x2 given f(x1) and I want to plot both on the same axis. What I mean is that I have a range of values for y, which I plot for different x1 and x2, which I'd like to have on the same axis.

$\endgroup$
  • $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour and check the faqs! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$ – Dunlop Dec 4 '18 at 4:13
  • 2
    $\begingroup$ Can you give some example data? If you have a list of data try ListPlot if you look at the documentation you should find how to plot two sets of data. $\endgroup$ – Dunlop Dec 4 '18 at 4:16
0
$\begingroup$

Obtaining "the form of f(x2)" by InverseFunction and plotting x1 and x2.

(* some random x data *)
x1 = Accumulate[Table[RandomInteger[10], 10]];

Clear[f, invf]
f[x_] := x^2 - 0.2 x + 3;
y = f /@ x1;

invf = Quiet[InverseFunction[f]];
x2 = invf /@ y;
ListPlot[{Transpose[{x1, y}], Transpose[{x2, y}]}]

enter image description here

$\endgroup$

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.