matlab解有约束的非线性优化我用matlab优化工具箱或者遗传算法工具箱都试过,没有成功.水平有限,我给出一组初值x(1)=2e-3x(2)=0.5e-3x(3)=6e-3问题描述如下:%%%%%%%%%%%%%%参数取值%%%%%%%d1=24e-3 D=84e-3d=17
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/27 13:33:29
matlab解有约束的非线性优化我用matlab优化工具箱或者遗传算法工具箱都试过,没有成功.水平有限,我给出一组初值x(1)=2e-3x(2)=0.5e-3x(3)=6e-3问题描述如下:%%%%%%%%%%%%%%参数取值%%%%%%%d1=24e-3 D=84e-3d=17
matlab解有约束的非线性优化
我用matlab优化工具箱或者遗传算法工具箱都试过,没有成功.
水平有限,
我给出一组初值
x(1)=2e-3
x(2)=0.5e-3
x(3)=6e-3
问题描述如下:
%%%%%%%%%%%%%%参数取值%%%%%%%
d1=24e-3
D=84e-3
d=17e-3
z=7
rmax=0.1744
n=1460
ps=1e+7
R=28e-3
fth=1.1
fmth=0.95
W1=500
W2=500
W3=1
brmin=2
Kb=1.2
p0=30e+6
vr0=7
v00=2.5
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%中间变量%%%%%%%%%%%%%%%%%%%%%%%%%%
r3=x(3)-Kb*x(2)
r2=2*x(1)-r3
r1=r2-x(2)
Fp=0.125*(z+1)*pi*d.^2*ps
M0=0.125*pi*d.^2*R*ps/sin(pi/(2*z))
a0=(R/x(1))*asin(d/(2*R))
faif=(z-1)*pi/z+a0
Fb=0.25*faif*((x(3).^2-r3.^2)/log10(x(3)/r3)-(r2.^2-r1.^2)/log10(r2/r1))*ps
Mb=2*((x(3).^2-r3.^2)/log10(x(3)/r3)-(r2.^2-r1.^2)/log10(r2/r1))*ps/9
Ae=pi*(x(3).^2-r1.^2)-(pi-a0)*(r3.^2-r2.^2)
rd=(r3-r2)/2
Sd=0.5*(r3.^2-r2.^2)*(2*asin(0.5*d/R)-4*asin(0.5*rd/x(1)))+pi*rd.^2
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%目标函数%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
fval=W1*abs(Fp/Fb-fth)+W2*(M0/Mb-fmth)+W3*((pi*(x(3).^2-r1.^2)-(pi-a0)*(r3.^2-r2.^2))/(0.25*pi*D.^2))
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%约束%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
g1=M0/Mb-1
g2=(Fp-Fb)/Ae-p0
g3=(pi*n/30)*x(1)-vr0
g4=0.25*pi*d.^2*(pi*n/30)*R*tan(rmax)/Sd-v00
g5=x(3)-0.5*D
g6=0.5*d1-r1
g7=brmin-x(2)
g8=rd-2*x(1)
g9=-rd
matlab解有约束的非线性优化我用matlab优化工具箱或者遗传算法工具箱都试过,没有成功.水平有限,我给出一组初值x(1)=2e-3x(2)=0.5e-3x(3)=6e-3问题描述如下:%%%%%%%%%%%%%%参数取值%%%%%%%d1=24e-3 D=84e-3d=17
太麻烦了,给你个例子,仔细琢磨吧.
function hh
a1 = 2; a2 = 1.5; % define parameters first
options = optimset('LargeScale','off'); % run medium-scale algorithm
[x,fval] = fmincon(@(x)myfun(x,a1),[2e-3 ;0.5e-3;6e-3 ],[],[],[],[],[],[],@(x)mycon(x,a2),options)
function f = myfun(x,a1)
f = x(1)^2 + a1*x(2)^2;
function [c,ceq] = mycon(x,a2)
c = a2/x(1) - x(2);
ceq = [];
结果:
x =
1.4565
1.0299
fval =
4.2426