Hi Jenny,
I understand that you are interested in automatically specifying and modifying the color of the line in the plot generated by the function "ipvd.m".
You can accomplish this task by making a minor modification to the function's code. In the last line of code in "ipvd.m", you should return the handle to the quiver object, as follows:
q = quiver(posX(1:n),posY(1:n),vx(:),vy(:),0);
Right now, this function does not appear to return any variables, even though you are treating it like it is. You should output this quiver object from the function:
function q = ipvd(vx,vy,xo,yo)
Just like other graphics objects in MATLAB, you can modify various property values through the quiver's handle. I have included a documentation link that provides information about the quiver series properties.
For example, the following code modifies the color of the quiver's line:
q = ipvd(1:10, 1:10);
q.Color = 'green'; % One syntax for modifying color
set(q,'Color','red'); % Another syntax
I hope this helps.
Matt