码迷,mamicode.com
首页 > 其他好文 > 详细

二元函数临界点的局部极值

时间:2017-04-14 14:39:23      阅读:319      评论:0      收藏:0      [点我收藏+]

标签:技术分享   技术   alt   closed   gif   figure   play   div   opened   

技术分享
close
figure(2)
syms x y
f=2.*x.^4+y.^4-2.*x.^2-2.*y.^2+3;
fx=diff(f,x);
fy=diff(f,y);
fxx=diff(f,x,2);
fyy=diff(fy,y);
fxy=diff(fx,y);
fx
fy
fxx
fyy
fxy
[a,b]=solve(fx,fy)
t=fxx*fyy-fxy^2;
t

tmp=2^(1/2)/2;

k1= subs(t,[x,y],[-tmp,0])
k2=subs(t,[x,y],[tmp,0])
k3=subs(t,[x,y],[-tmp,-1])
k4=subs(t,[x,y],[tmp,-1])
k5=subs(t,[x,y],[-tmp,1])
k6=subs(t,[x,y],[tmp,1])
k7=subs(t,[x,y],[0,0])
k8=subs(t,[x,y],[0,-1])
k9=subs(t,[x,y],[0,1])

 z1=subs(f,[x,y],[-tmp,0])
 z2=subs(f,[x,y],[tmp,0])
 z3=subs(f,[x,y],[-tmp,-1])
 z4=subs(f,[x,y],[tmp,-1])
z5=subs(f,[x,y],[-tmp,1])
z6=subs(f,[x,y],[tmp,1])
z7=subs(f,[x,y],[0,0])
z8=subs(f,[x,y],[0,-1])
z9=subs(f,[x,y],[0,1])
 
 
u=-3/2:0.1:3/2;
v=-3/2:0.1:3/2;
[x,y]=meshgrid(u,v);

z=2.*x.^4+y.^4-2.*x.^2-2.*y.^2+3;
surf(x,y,z);
 hold on

 contourf(x,y,z)
 
 plot(-tmp,0,*r)
 plot(tmp,0,*r)
 plot(-tmp,-1,*r)
 
  plot3(-tmp,0,z1,*g)
  plot3(tmp,0,z2,*g)
  plot3(-tmp,-1,z3,*g)
  plot3(tmp,-1,z4,*g)
  plot3(-tmp,1,z5,*g)
  plot3(tmp,1,z6,*g)
  plot3(0,0,z7,*g)
  plot3(0,-1,z8,*g)
  plot3(0,1,z9,*g)

 

% axis equal
View Code

 

二元函数临界点的局部极值

标签:技术分享   技术   alt   closed   gif   figure   play   div   opened   

原文地址:http://www.cnblogs.com/wdfrog/p/6708428.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!