필터 지우기
필터 지우기

Using the diff command and solve command

조회 수: 1 (최근 30일)
lateef
lateef 2023년 3월 29일
답변: Walter Roberson 2023년 3월 29일
can someone take a look at my code and tell my why its not outputing the paritial derivatives of fx and fy
the instructions were
Plot the function f (x, y) = 2x3y − y2 − 3xy.
Find fx and fy using the diff command. Setting these to zero, solve the resulting system of
equations using the solve command.
i used both diff command and solve command im not getting an error message for my lines of code but the code doesnt output an answer my code is below
f=@(x,y) 2*x^3*y - y^2 - 3*x*y;
syms x y;
G = [diff(f,x); diff(f, y)];
solve x y
Incorrect number or types of inputs or outputs for function 'solve'.

답변 (1개)

Walter Roberson
Walter Roberson 2023년 3월 29일
f=@(x,y) 2*x^3*y - y^2 - 3*x*y;
syms x y;
G = [diff(f,x); diff(f, y)];
sol = solve(G, [x y])
sol = struct with fields:
x: [5×1 sym] y: [5×1 sym]
subs([x, y], sol)
ans = 

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by