遗传算法错误提示:试图访问 x(2);由于 numel(x)=1,索引超出范围。
以下程序代码:
function f = fun(x)
Q = 5; % 耗散功率,单位 W
I = 1; % 电流数值 A
Ta = 303.15; %环境温度,单位K
T_d = 333.15; %热源温度,单位K
Rnc_ = 10; %自然对流热阻,单位K/W
delta = 0.00007; % A 导热胶厚度,单位 m
lambda = 3; % B 导热系数,单位 W/m K
delta_epsilon = 0.03; % a热源边长,单位 m
Ad = delta_epsilon^2; % Ad 热源面积,单位 m^2
Rid = delta/lambda/Ad; % Rid 界面热阻,单位 K/W
T_cmax = T_d-Q*Rid; % Tc,max界面最高温度,单位 K
L = 0.03;% TEC边长,单位 m
L1 = L;
L2 = L;
epsilon_1 = 0.015; % 热源中心坐标,单位 m
epsilon_2 = 0.015; % 热源中心坐标,单位 m
x = epsilon_1;
x_ = x/L; % x-,单位 m
y = epsilon_2;
y_ = y/L; % y-,单位 m
epsilon_1_ = x_; % ξ1-
epsilon_2_ = y_; % ξ2-
delta_epsilon_1 = delta_epsilon/2;
delta_epsilon_2 = delta_epsilon/2;
adelta_epsilon_1_ = delta_epsilon_1/L; % Δξ1-
adelta_epsilon_2_ = delta_epsilon_2/L; % Δξ2-
M = [epsilon_1_-adelta_epsilon_1_,epsilon_1_+adelta_epsilon_1_]; % M 区域的集合范围
alpha = 0.054; % 塞贝克系数,单位V/K
K = 0.537; % 热导,单位W/K
d = 0.001; % 氧化铝陶瓷板厚度,单位m
kc = 16.75; % 陶瓷板导热系数,单位W/m K
R = 2.2; % 电阻,单位Ω
B1 = (alpha*I+K)/kc/d*L^2; %
B2 = B1;
m1 = sinh(2*(B2.^0.5)); %计算p1中间步骤;
m2 = (m1/2/(B2.^0.5)+1)^-1; %是否有误要加^-1
m3 = B2*((1.5-m2)^-1); %计算p1中间步骤
p1 = L1/L2*(m3.^0.5);
p2 = p1;
K1 = 2*sinh(p1*adelta_epsilon_1_).*cosh(p1*(1-epsilon_1_))/sinh(p1);
K2 = K1;
fai_1 = K1*cosh(p1*x_)-cosh(p1*(x_-epsilon_1_+adelta_epsilon_1_))+1;
fai_2 = fai_1;
fai_1_ = K1./p1.*sinh(p1)-2*cosh(p1.*(1-epsilon_1_)).*sinh(p1.*adelta_epsilon_1_)/p1+2*adelta_epsilon_1_;
fai_2_ = fai_1_;
fai_2 = fai_1 ;
Rcsp = (fai_1 .*fai_2-fai_1_.*fai_2_).*L1*L2./4*delta_epsilon_1.*delta_epsilon_2.*(alpha*I+K); %冷端扩散热阻,单位K/W
Tc_ = T_cmax-Rcsp.*Q; %冷端平均温度,单位K
QL = Q; %冷端吸收热量
RTEC = (QL-alpha.*I.*Tc_+1/2.*I.*I.*R)/K/QL; %TEC热阻,单位K/W
Th_ = Tc_-RTEC*QL; %热端平均温度,单位K
Qh = alpha.*I.*Th_+1/2.*I.*I.*R-K.*(Th_-Tc_); %热端吸热量,单位W
As = L*L; %TEC面积,单位m^2
Ri2 = delta/lambda/As; %界面热阻,单位K/W
Tbcon = Th_-Ri2*Qh; %界面平均温度,单位K
Ab = x(1)*x(2);% 散热器底座面积,单位m^2
Kb = 237; %底座导热系数,单位W/m K
m4 = 1/2/Kb/As^0.5*(1-(As/Ab)^0.5)^1.5;
m5 = (Ab^0.5-As^0.5)/Kb/(pi*Ab*As)^0.5;
m6 = pi^1.5/Ab^0.5+1/As^0.5;
m7 =(m6*Kb*Ab*Rnc_+tanh(m6*x(3)))/(1+m6*Kb*Ab*Rnc_*tanh(m6*x(3)));
Rcons = (m4-m5)*m7*Qh/QL; %热面紧缩热阻,单位K/W
Tbmax = Tbcon-QL*Rcons; % 底座最高温度,单位K
RTECt = Rcons+Ri2+RTEC+Rcsp+Rid; %汇总TEC的总热阻,单位K/W
Rsp = m5*m7*Qh/QL;%底座扩散热阻,单位K/W
Tb_ = Tbmax-Rsp*QL;%底座平均温度,单位K
Rb = x(3)/Kb/Ab*Qh/QL;%底座热阻,单位K/W
Tf_ = Tb_-Rb*QL; %肋片的平均温度,单位K
S = 0.0012;%肋片间距,单位m
H = 0.025;%肋片高度,单位m
delta_f = 0.001;%肋片厚度,单位m
N = floor((x(1)+S)/(delta_f+S));%肋片数目
AT = (2*H*x(2)+2*H*delta_f+delta_f*x(2))*N;%肋片面积,单位m^2
epsilon_f = 0.85;
Kf = 0.0267; %导热系数,单位W/m K
g = 9.8; %重力加速度,单位m/s^2
beta = 0.00333;%膨胀系数,单位1/K
T_ = Tf_-Ta; %温差,单位K
Va = 0.000016;%运动黏度,单位m^2/s
alphaa = 2.29E-05; %热扩散系数,单位m^2/s
Ra = g*beta*T_*S^3/Va/alphaa;
k1 = 5.67E-08;%黑体常数,单位W/m2 K4
Pr = 0.701;
Gr = Ra/Pr;
NR = k1.*Ta^4.*S./Kf./T_./Gr.^0.25;
m8 = ((1+epsilon_f)./(1+NR)).^0.1;
Rnc = (0.102.*Ra.^0.36.*(S/H).^0.4.*m8.*(N.^-0.04).*Kf.*AT/S).^-1.*Qh/QL; %对流换热热阻,单位K/W
Ta_ = Tf_-QL*Rnc;%计算的环境温度,单位K
RHS = Rsp+Rb+Rnc;
f = RTECt+RHS;