# Manipulate or animate a Vector Field or VectorPlot [duplicate]

This question already has an answer here:

I want to plot a time dependant vector field, and see variation with time,

Like this :

U = 0.5 + 0.8 x;
V = 1.5 + 2.5 Sin[2 Pi t] - 0.8 y;


But when I do:

Manipulate[VectorPlot[{U, V}, {x, -5, 5}, {y, 0, 5}], {t, 0, 1}]


or

Animate[VectorPlot[{U, V}, {x, 0, 5}, {y, -1, 5}], {t, 0, 10}]


it shows blank space, nothing is visible. And VectorPlot3D is confusing, I mean it shows all variations on top of other but I wanted to see it as in Manipulate. because Manipulate and Animate returned blank box. Its not answered in How are parameters evaluated for a Plot in Manipulate

Pls Help

## marked as duplicate by Kuba♦Feb 17 '17 at 6:57

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

## 1 Answer

There are 3 things wrong in your code:

1) The brackets around Pi in the definition of V;

2) You use x,y in the definitions, but a,b in Manipulate;

3) You need to "expose" t to manipulate.

This works:

U = 0.5 + 0.8 x;

V = 1.5 + 2.5 Sin[2 Pi t] - 0.8 y;

Manipulate[
VectorPlot[{U, V} /. t -> tt, {x, -5, 5}, {y, 0, 5}], {tt, 0, 1}]


Edit: Regarding "exposing" parameters to Manipulate, the documentation on Manipulate under Possible Issues notes that "Manipulate only "notices" explicit visible parameters" and gives an example of making a hidden parameter visible by exposing it as an argument in a function. The use of the Rule and Replace does essentially the same thing. The t->tt with tt being the parameter being manipulated makes it visible to Manipulate. In some cases, this could also be done by forcing evaluation of the expression being manipulated. But that can't be used in this case because it would force evaluation of VectorPlot with its range specified by a non-numeric value.

• Thank you David, this solved my question. Can you put few more things about 'expose' that "/.t -> tt" part? – Aditya M Arabhavi Feb 19 '17 at 16:38