Local extreme values for a differential equation, using solve?

1 次查看(过去 30 天)
Hi,
I am trying to calculate the local extreme values for a differential equation using the function solve. The problem is the values I get does not match the extreme values I can see in the plot for the function.
This is the code:
syms x y %Symbolic x and y
f= (x^3*y+5*x^2*y)/(exp(x^2+3*y^4)); %The function
figure(1)
ezsurf(f,[-2,0.1,2],[-2,0.1,2]) %3D-plot
grid on
box on
fx=diff(f,x) %Differeniate the function w.r.t x
fy=diff(f,y) %Differeniate the function w.r.t y
S=solve(fx,fy); %Solving the differential equations (=0)
x = double(S.x); %Rewrite the value to a number from the struct
y = double(S.y);
If I run the code I get that x=0 and y=0, which cant not be correct compared to what is seen in the figure created in the code. I know that there are other methods to solve this problem, but this is the method I was told to use to solve this assignment.
Thank you for your help. Regards

回答(1 个)

Christopher Creutzig
I think they are correct, the solution is just not complete, since it was computed numerically.
You could try solve(simplify(fx), simplify(fy)) instead, which returns 18 solutions. If you restrict x and y to be real by calling syms x y real, you get 10 solutions.

类别

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