Subscript indices must either be real positive integers or logicals 头痛死了n_max=[30 25 22 23 21 20 19 17 16 12];n_min=[60 51 45 46 42 40 38 35 33 25];format longr=[3.2 3.49 3.64 3.75 3.84 3.91 4.02 4.14 4.34 4.97]*10^-3;su=[10000:10000:100000];
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/23 22:46:06
Subscript indices must either be real positive integers or logicals 头痛死了n_max=[30 25 22 23 21 20 19 17 16 12];n_min=[60 51 45 46 42 40 38 35 33 25];format longr=[3.2 3.49 3.64 3.75 3.84 3.91 4.02 4.14 4.34 4.97]*10^-3;su=[10000:10000:100000];
Subscript indices must either be real positive integers or logicals 头痛死了
n_max=[30 25 22 23 21 20 19 17 16 12];
n_min=[60 51 45 46 42 40 38 35 33 25];
format long
r=[3.2 3.49 3.64 3.75 3.84 3.91 4.02 4.14 4.34 4.97]*10^-3;
su=[10000:10000:100000];
sita=zeros(10,10)
for i=1:10
for j=1:10
sita(i,j)=2*atan(((8*r(i)*su(j) + 9)^(1/2) - 1)/(4*r(i)*su(j) + 4));
end
end
%
oe=zeros(10,10);
be=zeros(10,10);
fbg=zeros(10,10);
bqe=zeros(10,10);
Asl=zeros(10,10);
Asd=zeros(10,10);
r1=zeros(1,10);
for i=1:10
for j=1:10
r1(i)=r(i)./cos(sita(i,j))-r(i);
be(i,j)=r(i).*sin(sita(i,j));
fbg(i,j)=(pi/2-sita(i,j))./(2*pi)*pi*(r1(i)).^2*sin(sita(i,j)).*cos(sita(i,j));
bqe(i,j)=sita(i,j)./(2*pi)*pi*r(i).^2.*sin(sita(i,j)).*cos(sita(i,j));
Asl(i,j)=(oe(i,j)*be(i,j)-fbg(i,j)-bqe(i,j))*8;
Asd(i,j)=(oe(i,j)*be(i,j)-fbg(i,j)-bqe(i,j))*12;
end
end
错误?Subscript indices must either be real positive integers or logicals.
Error in ==> hydric_test at 39
r1(i)=r(i)./cos(sita(i,j))-r(i);
请问这是什么原因?然后帮我改改程序啊
Subscript indices must either be real positive integers or logicals 头痛死了n_max=[30 25 22 23 21 20 19 17 16 12];n_min=[60 51 45 46 42 40 38 35 33 25];format longr=[3.2 3.49 3.64 3.75 3.84 3.91 4.02 4.14 4.34 4.97]*10^-3;su=[10000:10000:100000];
程序可运行,完全没有错误.复制以下程序到一个m文件运行看看,注意清除变量.
clear;
clc;
n_max=[30 25 22 23 21 20 19 17 16 12];
n_min=[60 51 45 46 42 40 38 35 33 25];
format long
r=[3.2 3.49 3.64 3.75 3.84 3.91 4.02 4.14 4.34 4.97]*10^-3;
su=[10000:10000:100000];
sita=zeros(10,10);
for i=1:10
for j=1:10
sita(i,j)=2*atan(((8*r(i)*su(j) + 9)^(1/2) - 1)/(4*r(i)*su(j) + 4));
end
end
%
oe=zeros(10,10);
be=zeros(10,10);
fbg=zeros(10,10);
bqe=zeros(10,10);
Asl=zeros(10,10);
Asd=zeros(10,10);
r1=zeros(1,10);
for i=1:10
for j=1:10
r1(i)=r(i)./cos(sita(i,j))-r(i); %%%%%%% 这一行得到的结果可能不是你想要的
be(i,j)=r(i).*sin(sita(i,j));
fbg(i,j)=(pi/2-sita(i,j))./(2*pi)*pi*(r1(i)).^2*sin(sita(i,j)).*cos(sita(i,j));
bqe(i,j)=sita(i,j)./(2*pi)*pi*r(i).^2.*sin(sita(i,j)).*cos(sita(i,j));
Asl(i,j)=(oe(i,j)*be(i,j)-fbg(i,j)-bqe(i,j))*8;
Asd(i,j)=(oe(i,j)*be(i,j)-fbg(i,j)-bqe(i,j))*12;
end
end
注意:
r1(i)=r(i)./cos(sita(i,j))-r(i); %%%%%%% 这一行得到的结果可能不是你想要的
r1(1) = r(1)/cos(sita(1,10))-r(1)
r1(2) = r(2)/cos(sita(2,10))-r(2)
.
有问题欢迎追问,对你有帮助请给采纳.