I have defined several functions with equations like
function dZ = ODE(~,z) x = z(1); y = z(2); dZ = [x+y;... 4*x-2*y]; end
These functions are used by other functions for solving etc. Now I want to do plotting with quiver but I don't figure out how to pass a function with equations as a parameter to quiver. It should look like this:
odehandle = str2func('ODE');plot_vectorfield(odehandle);function plot_vectorfield(odehandle) [x,y]=meshgrid(-10:1:10,-10:1:10); [dx,dy]=odehandle; %does not work!
quiver(x,y,dx,dy);end
So the problem is obviously how to pass the u,v parameter to quiver. I would also like to know how to handle function defined equation systems with 3 equations with quiver. Thanks a lot!
Best Answer