函数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.

 Akzeptierte Antwort

cadon
cadon am 24 Nov. 2022

0 Stimmen

表达式里 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)

Weitere Antworten (0)

Kategorien

Mehr zu MATLAB 快速入门 finden Sie in Hilfe-Center und File Exchange

Tags

Gefragt:

am 24 Nov. 2022

Beantwortet:

am 24 Nov. 2022

Community Treasure Hunt

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

Start Hunting!