Subscript indices must either be real positive integers or l
首页/题库/399℃/2024-07-20 01:28:11
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);
请问这是什么原因?然后帮我改改程序啊
优质解答:
程序可运行,完全没有错误.复制以下程序到一个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)
.
有问题欢迎追问,对你有帮助请给采纳.
我来回答修改/报错/举报内容!
猜你喜欢
- 商店运来一批水果,其中梨占这批水果的20%,苹果占这批水果的35%.已知苹果比梨多450Kg,这批水果一共有多少千克?答
- 50g某硫酸溶液恰好与6.5g锌完全反应试计算这种硫酸溶液中溶质的质量分数
- 初中仿写句子:家是难舍的亲情,在这里,父母用慈爱的伞为儿女们撑起一方晴空.
- 《童趣》为中叙述了哪些“物外之趣”
- (2/2)离子.硫酸根离子 C钾离子.碳酸根离子.钠离子.氯离子 D镁离子.氯离子.钾离子.硫酸根离子
- 桑塔纳旅行车后窗雨刮开关在哪里呀?
- 是不是文科班的学霸语文所有古诗文言文都能倒背如流,英语书上几乎所有单词短语语法都能熟记于心,数学所有公式定理都了解,政史
- 有一个7层的灯塔,每层所点的灯的盏数都是上面一层的2倍,一共点了381盏灯,
- "世上无难事,只怕有心人"是名言吗?
- 求半径是6分米的圆的面积和直径是7厘米的圆的面积
- All the positive integers less than 49 are multiplied togeth
- If x and y are positive integers such that x=8y+12,what is t