for i = 5:1:97
h = [];
for j = hmin+2:i:hmax+2
h = [h, j];
if j ~= hmax+2
jp = j + i;
h = [h, jp];
end
disp(h);
p = hmin;
u = 1;
while u <= numel(h) %
hn = [];
while h(u) - table3(p, 1) >= 2 && p <= hmax %
p = p + 1;
hn = [hn, (h(u) - table3(p, 1) - 2) * table3(p, 2)];
end
u = u + 1;
c = sum(hn, 2);
disp(c);
end
c = 0;
end
end
1.我想让c成为hn所有数的总和,但结果输出c=-2,hn=3,按理说数值应该过万的,想请教正确的做法。
2.h向量不知道为什么元素数量翻倍了,求解。