Message Boards Message Boards

Create a Manipulate that plots the following expression?

GROUPS:
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}]
POSTED BY: greprep786
Answer
10 months ago

Wrap all of your code in a Module[{}, your-code-goes-here-with-each-line-separated-by-a-semicolon]

Put that in the Manipulate

POSTED BY: Neil Singer
Answer
10 months ago

You may try this:

xhi = 10; xlo = 0; xstep = (xhi - xlo)/100;
x = Table[xlo + (i - 1)*xstep, {i, 101}];
Ca0 = Table[5 + (i - 1), {i, 101}];
Manipulate[
 Da1 = a1*x; Ea2 = a2*(x^2);
 y = Da1 + Ea2 + a0;
 data = Transpose@{x, y};
 ListPlot[{data}], {{a0, 9}, 0, 9, 1}, {{a1, 4}, 0, 7, 1}, {{a2, 1}, 
  0, 7, 1}]
POSTED BY: Valeriu Ungureanu
Answer
10 months ago

Thanks can you please let me know what is the meaning of 4 in {a1, 4} and 1 in {a2, 1} respectively.

POSTED BY: greprep786
Answer
10 months ago

Initial values for a1, and a2 correspondingly.

POSTED BY: Valeriu Ungureanu
Answer
10 months ago

Group Abstract Group Abstract