3
$\begingroup$

I am fitting a theoretical equation for a complicated curve to some experimentally measured data. As you might be aware, algorithmically quantifying 'goodness of fit' for a complicated curve is something of a dark art...

I want to load the experimental data and display it in a graph, and then over the top have a manipulable plot of the generated curve superimposed, so that I can tweak the parameters by eye until the fit looks good.

I can plot the measured data, and I can plot the manipulable curve from theory, but I need them to be plotted on top of each other!

I'm having trouble getting it to show the two graphs at once though... is it possible?

Many thanks, Ben

$\endgroup$
  • $\begingroup$ check out Show $\endgroup$ – Pinguin Dirk Sep 2 '13 at 13:17
  • $\begingroup$ Manipulate[ Show[ Plot[...], ListPlot[...]], {...}]. This question has been asked many times, and of course is a duplicate. $\endgroup$ – Artes Sep 2 '13 at 13:20
  • $\begingroup$ Plot[ <<>>, Epilog -> Points@expdata is a good way too. $\endgroup$ – Kuba Sep 2 '13 at 13:21
5
$\begingroup$

Show can help you, as in this example:

preMadePlot = Plot[Sin[x], {x, 0, 2 Pi}]
Manipulate[Show[
  preMadePlot,
  Plot[Sin[p x], {x, 0, 2 Pi}]
  ], {p, 1, 10}]
$\endgroup$
  • $\begingroup$ Thank you very much everyone! I was very close but misusing Show. Cheers! $\endgroup$ – Ben Sep 2 '13 at 13:35

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.