我写了这样的代码
clc;
clear;
clf;
A = NaN(141, 7);
ind = [1, 41, 141];
nind = setdiff(1:141, ind);
A(ind, :) = [1.46, 1.117, 0.945, 0.805, 0.675, 0.613, 0.555;
0.877, 0.687, 0.605, 0.535, 0.463, 0.423, 0.385;
0.52, 0.425, 0.405, 0.37, 0.325, 0.315, 0.28];
for k = 1:7;
A(nind, k) = interp1(ind, A(ind, k), nind, 'pchip');
end
B = NaN(141, 61);
inde = [1, 11, 21, 31, 41, 51, 61];
ninde = setdiff(1:61, inde);
B(:, inde) = A;
for n = 1:141;
B(n, ninde) = interp1(inde, B(n, inde), ninde, 'pchip');
end
for x = 30:90
xi = x./100;
XM = x.-29;
for P = 1:0.1:15
PM = P.*10-9;
ASU = (68.070476/xi)*((xi-0.23)*(0.11+0.6998*log(P))+(1.23-xi)*0.7734*log(P));
CSU = B(PM,XM);
RCV = (0.00004*P.^5-0.004*P.^4+0.146*P.^3-2.5525*P.^2+21.396*P+806.87)*1000;
R = (RCV-ASU-CSU)/874590*100;
fprintf('Pressure %f bar Concentration %f percent Efficiency %f percent\n', P, x, R)
end
end
并且它显示'下标索引的错误必须是小于2 ^ 31的正整数或逻辑'。 Octave表示问题出在这里。
CSU = B(PM,XM);
我该如何解决这个问题?