how to plot the gradient of a equation having specific region?

조회 수: 1 (최근 30일)
Muhammad
Muhammad 2022년 10월 18일
답변: Star Strider 2022년 10월 18일
hello i have the equation
f(x,y)=-5x^3+4yx+6y^3+1
the gradient with respect to x is
f(x)=-15*x^3+4*y
how to plot the gradient having area
-2<x<2, -2<y<2

답변 (2개)

Torsten
Torsten 2022년 10월 18일
x = -2:0.1:2;
y = x;
[X,Y] = meshgrid(x,y);
f = @(x,y) -15*x.^2+4*y;
surf(X,Y,f(X,Y))

Star Strider
Star Strider 2022년 10월 18일
Perhaps this —
syms x y
f(x,y)=-5*x^3+4*y*x+6*y^3+1
f(x, y) = 
Gf = gradient(f,x)
Gf(x, y) = 
figure
fsurf(Gf, [-2 2 -2 2])
xlabel('X')
ylabel('Y')
.

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by