matlab下标索引必须为正整数类型或逻辑类型怎样修改


close all;
clc;
help exp;
Fujian1=xlsread('C:\Users\cumcm\Desktop\shuju.xlsx','附件1','A3:E6'); 
Fujian2=xlsread('C:\Users\cumcm\Desktop\shuju.xlsx','附件2','A3:B5403');
ro=Fujian1(:,1); 
c=Fujian1(:,2); 
k=Fujian1(:,3);
l(1)=0.0006; 
l(2)=0.006; 
l(3)=0.0036; 
l(4)=0.005;
t = 0.03;       %时间范围,计算到0.03秒
x = 1;          %空间范围,0-1米
N=(l(1)+l(2)+l(3)+l(4))/x;%空间分割 
M=5400/t;%时间分割
ht =0.02;   %时间步长dt
hx =0.0002;   %空间步长dx
for n=1:4 
r(n)=k(n)*t/(c(n)*ro(n)*(x^2));
end %计算网比
for j=1:M 
u(1,j)=75; 
u(N,j)=8.773e-17*power(j/50,5)-1.354e-12*power(j/50,4)+7.803e-09*power(j/50,3)-2.065e-05*power(j/50,2)+0.02451 *j/50+37.91;
end 
%赋边值
for i=2:N-1 
u(i,1)=37; 
end 
for j=1:M-1 
for i=2:N-1 
if i<=(l(1)/x) 
u(i,j+1)=r(1)*u(i+1,j)+(1-2*r(1))*u(i,j)+r(1)*u(i-1,j);% 第 1 层的传导 
else if i<=((l(1)+l(2))/x) % 第 2 层的传导 
u(i,j+1)=r(1)*u(i+1,j)+(1-2*r(1))*u(i,j)+r(1)*u(i-1,j); 
else if i<=((l(1)+l(2)+l(3))/x) % 第 3 层的传导 
u(i,j+1)=r(1)*u(i+1,j)+(1-2*r(1))*u(i,j)+r(1)*u(i-1,j); 
else % 第 4 层的传导 
u(i,j+1)=r(1)*u(i+1,j)+(1-2*r(1))*u(i,j)+r(1)*u(i-1,j); 
end 
end 
end 
end 
end
j=1; 
for k=1:270 
if round(k/100)==k/100 
b(:,j)=u(:,k); 
j=j+1; 
end 
end
mesh(b)

下标索引必须为正整数类型或逻辑类型。

出错 Untitled (line 24)


u(N,j)=8.773e-17*power(j/50,5)-1.354e-12*power(j/50,4)+7.803e-09*power(j/50,3)-2.065e-05*power(j/50,2)+0.02451
*(j/50)+37.91;

没看错的话,N是个小数吧,小数不能作为数组索引的