函数g=0.2*sqrt(2*pi*b/(a.^2-1))*log(sqrt(a+(a.^2+b.^2))/(1+sqrt(1+b.^2)))做出三维图形,并求出极值,其中0<=x<=10,0<=y<=10.

 Réponse acceptée

cadon
cadon le 24 Nov 2022

0 votes

表达式里 a 是 x,b 是 y 吗?如果是的话,a 不能小于 1,否则 a.^2-1 为负数,外面的sqrt就会得到复数
所以你的 x 的范围似乎应该是1到10
g=@(a,b) 0.2*sqrt(2*pi*b./(a.^2-1)).*log(sqrt(a+(a.^2+b.^2))./(1+sqrt(1+b.^2)));
[x,y] = meshgrid(1:0.1:10, 0:0.1:10);
mesh(x,y,g(x,y))
lb = [1 0]; ub = [10 10];
x0 = (lb+ub)/2;
options = optimset('Algorithm','interior-point');
x = fmincon(@(x) g(x(1),x(2)),x0,[],[],[],[],lb,ub,[],options)

Plus de réponses (0)

Catégories

En savoir plus sur 二维图和三维图 dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!