フィルターのクリア

Plot different types of plots on same graph

2 ビュー (過去 30 日間)
Billy
Billy 2012 年 5 月 20 日
Assume I've defined
f2 := (x,y) -> x*exp(y) + cos( x*y )
and
gf2 := gradient( f2(x,y), [x,y] )
I'd like to plot the level curves of the function, as well as the vector field of the gradient, on one plot.
plot(
// level curves
plot::Implicit2d( f2(x,y)=Z, x=-5..5, y=-5..5, Color=[-Z/10,Z/10,0] ) $ Z=-2..2,
// gradient
plot( plot::VectorField2d( gf2, x=-5..5,y=-5..5, Mesh=[10,10] ) )
)
This doesn't work though! It generates 2 plots.
Can I have mupad superimpose the gradient vector field with the level curves of the original function?
  2 件のコメント
per isakson
per isakson 2012 年 5 月 21 日
Try to insert "hold on" between the calls of plot
Walter Roberson
Walter Roberson 2012 年 6 月 27 日
Note: MuPAD has its own plotting system that is not based on handle graphics.

サインインしてコメントする。

回答 (1 件)

Andreas Sorgatz
Andreas Sorgatz 2012 年 6 月 27 日
The following input displays all objects in one plot:
f2 := (x,y) -> x*exp(y) + cos( x*y );
gf2 := gradient( f2(x,y), [x,y] );
plot(
// level curves
plot::Implicit2d( f2(x,y)=Z, x=-5..5, y=-5..5, Color=[-Z/10,Z/10,0] ) $ Z=-2..2,
// gradient
plot::VectorField2d( gf2, x=-5..5,y=-5..5, Mesh=[10,10] )
)

カテゴリ

Help Center および File Exchange2-D Function Plots についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by