0
$\begingroup$
xstep = (xhi - xlo)/100
x = Table [xlo + (i - 1)*xstep, {i, 1, 101}];
a0 = 9
a1 = 4
a2 = 1
a3 = 0
Ca0 = Table[5 + (i - 1), {i, 1, 101}];
Da1 = Table[a1*x];
Ea2 = Table[a2*(x^2)];
y = Da1 + Ea2 + a0;
data = Transpose@{x, y};
ListPlot[{data}]

I have the following code and wants to combine this with Manipulate command so that when I change the a0, a1, a2,a3, the output of graph changes. like in the following command

Manipulate[
 Plot[a* x^2 + b *x + c, {x, -100, 100}], {a, -1, 1, 0.2}, {b, -10, 
  10, 1}, {c, -50, +50, 5}]
$\endgroup$

closed as off-topic by Feyre, MarcoB, Sascha, happy fish, Öskå Feb 21 '17 at 10:53

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – happy fish, Öskå
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ You have defined Da1 and Ea2 erroneously, what are you trying to do there? $\endgroup$ – Feyre Feb 19 '17 at 10:38
  • $\begingroup$ Creating a series, first one equal to a1*x and Second one (a2*x^2). after that, I have to create a series y, which is equal to y = Da1 + Ea2 + a0. $\endgroup$ – GIS learner Feb 19 '17 at 10:58
  • 3
    $\begingroup$ I'm voting to close this question as off-topic because it is too localised and only relies on basic Mathematica programming skills, and is therefore unlikely to help others. $\endgroup$ – Feyre Feb 19 '17 at 11:59
2
$\begingroup$

Create a function data with arguments a0, a1, a2, xhi, and xlo.

xstep = (xhi - xlo)/100;
x = Table[xlo + (i - 1)*xstep, {i, 1, 101}];
Ca0 = Table[5 + (i - 1), {i, 1, 101}];
Da1 = a1*x;
Ea2 = a2*(x^2);
y = Da1 + Ea2 + a0;
data[a0_, a1_, a2_, xhi_, xlo_] = Transpose@{x, y};

Then, use Manipulate,

Manipulate[
 ListPlot[data[a0, a1, a2, xhi, xlo], Frame -> True], {{xhi, 9}, 1, 9,
   1}, {{xlo, 2}, 1, 5, 1}, {{a0, 9}, 1, 10, 1}, {{a1, 4}, 1, 10, 
  1}, {{a2, 1}, 1, 10, 1}, ControlType -> LabeledSlider]

enter image description here

$\endgroup$
  • $\begingroup$ why the graph output is not changing, when I am changing parameters value $\endgroup$ – GIS learner Feb 19 '17 at 11:50
  • $\begingroup$ @MuhammadRamzan Try restarting your kernel. $\endgroup$ – Feyre Feb 19 '17 at 11:58
  • $\begingroup$ how i can do that please $\endgroup$ – GIS learner Feb 19 '17 at 12:00
  • $\begingroup$ @MuhammadRamzan Run Quit[]. $\endgroup$ – Anjan Kumar Feb 19 '17 at 12:03
  • $\begingroup$ @ Anjan Kumar last thing how i can change my x-axis range let say from -500 to 500 $\endgroup$ – GIS learner Feb 19 '17 at 12:09

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