1

I'm trying to plot a family of functions differing only by a constant $c$. The function is: $2x^2-5x+c$. In order to plot them I'm using the following code:

Plot[For[i = 0, i < 4, i++, {2 x^2 - 5 x + i}], {x, -5, 5}]

but there's no output besides the axis. The iinside the loop For is equivalent to the constant $c$ of the function. How can I plot them using the For loop inside the Plot command? Is this possible?

Levy
  • 143
  • 5

1 Answers1

2
Table[
 Plot[2 x^2 - 5 x + i, {x, -5, 5}], 
 {i, 0, 3}]

or if you want them all on the same axes:

Plot[
 Evaluate@Table[2 x^2 - 5 x + i, {i, 0, 3}], 
 {x, -5, 5}]
David G. Stork
  • 41,180
  • 3
  • 34
  • 96