필터 지우기
필터 지우기

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 CenterFile Exchange에서 2-D Function Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by