Message Boards Message Boards

Manipulate a variable if that variable is my x-axis?

Posted 4 years ago

I'm pretty new to Mathematica so I'm very sorry if the question is too simple. I want to "animate" how would the distance travelled S1i change with time if the speed is constant, so here's a piece of code:

S1i[t_, V1i_] = t*V1i;
Manipulate[Plot[S1i[t, V1i], {t, 0, 10}], {t, 0, 10}]

and i just get graph with a straight line. I still can manipulate 't', but nothing changes.

So I tried manipulating 'V1i' instead of t, and I get the same problem:

S1i[t_, V1i_] = t*V1i;
Manipulate[Plot[S1i[t, V1i], {t, 0, 10}], {V1i, 0, 10}]

Thank you in advance.

POSTED BY: zare maz
2 Replies

Does the following help?

Your first case

S1i[t_, V1i_] = t*V1i;
Manipulate[
 Plot[S1i[t, V1i], {t, 0, time}, PlotRange -> {{0, 10}, {0, 100}}]
 , {time, 1, 10}
 , Initialization :> {V1i = 10}
 ]

Your second case

S1i[t_, V1i_] := t*V1i;
Manipulate[
 Plot[S1i[t, V1i], {t, 0, 10}, PlotRange -> {{0, 10}, {0, 100}}]
 , {V1i, 0, 10}
 ]
POSTED BY: Ian Williams

Does the following help?

Your first case

S1i[t_, V1i_] = t*V1i;
Manipulate[
 Plot[S1i[t, V1i], {t, 0, time}, PlotRange -> {{0, 10}, {0, 100}}]
 , {time, 1, 10}
 , Initialization :> {V1i = 10}
 ]

Your second case

S1i[t_, V1i_] := t*V1i;
Manipulate[
 Plot[S1i[t, V1i], {t, 0, 10}, PlotRange -> {{0, 10}, {0, 100}}]
 , {V1i, 0, 10}
 ]
POSTED BY: Ian Williams
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract