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)

.

有问题欢迎追问,对你有帮助请给采纳.

我来回答修改/报错/举报内容!

猜你喜欢

一个神奇的在线题库网,分享各类考试题库、题目资料与资料答案、在线搜题与练习等!
本网站部分内容、图文来自于网络,如有侵犯您的合法权益,请及时与我们联系,我们将第一时间安排核实及删除!
Copyright © 2021-2024 315题库 All Rights Reserved