How to use quiver with equations in function?
古いコメントを表示
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!
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Vector Fields についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!