Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I was wondering if it is possible to manipulate a FindFit[] function. As a basic example, if I had an equation $ax^2+bx+c$ and a set of data, would it be possible to manipulate the c value, while Mathematica outputs the best fit values for a and b for that c value?

share|improve this question
2  
Yes, just use an explicit value for c in the model you provide to FindFit. –  Sjoerd C. de Vries Jul 12 '13 at 20:10
    
One can theoretically Manipulate any expression. But see the SynchronousUpdating option to Manipulate for handling expressions that take a long time to compute. –  Michael E2 Jul 12 '13 at 23:38
add comment

2 Answers 2

Extending @bills answer a little further:

p = Table[Prime[x], {x, 20}];

Manipulate[
 Show[ListPlot@p, Plot[y /. FindFit[p, y = a x^2 + b x + c, {a, b}, x], {x, 1, 20}, 
                       Evaluated -> True]], 
{c, -10, 10}]

Mathematica graphics

share|improve this answer
add comment

Here's one way:

 p = Table[Prime[x], {x, 20}]; 
 Manipulate[FindFit[p, a x^2 + b x + c, {a, b}, x], {c, -10, 10}]

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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