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/05/03 13:49:28

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)
.
有问题欢迎追问,对你有帮助请给采纳.

Subscript indices must either be real posit... Subscript indices must either be real positive integers or logicals. Subscript indices must either be real positive integers or logicals. matlab为什么出现 Subscript indices must either be real positive integers or logicals.为什么出现>> A=[2 -3 -2;-1 2 1;4 -7 -6];>> C=det(A)Subscript indices must either be real positive integers or logicals. >> p=[1 0 3 12 7]p = 1 0 3 12 7>> roots(p)? Subscript indices must either be real positive integers or logicals.>> matlab中for语句画图,Subscript indices must either be real positive integers or logicals.for ii=0.1:1x=0:100y(ii)=(L-ii*hg)/(ii*hg)*x-G*b/hg;plot(x,y(ii))hold onend出现Subscript indices must either be real positive integers or logicals.这个 matlab运行 >> x=1:0.01:200; >> a=max(x);出现Subscript indices must either be real positive integers orlogicals.程序明显没有问题,在2012b上可以运行,系统版本2010b MATLAB function numpositivi=es1(flussi)nf=numel(flussi); numpositivi=0; for i=1:nf if flussi(i)>0 � numpositivi=numpositivi+1end end检验> V=[1 -2 4 -2 -8 -5 6 8 10]V =1 -2 4 -2 -8 -5 6 8 10>> es1(V)Subscript indices must either be real posit matlab num=[4];den=[1 2 1]; margin(num,den),grid; w=0.1:1000; [mag,phase,w]=bode(num,den);mag(1)mag(1.5)输出:mag(1)=3.9996但是mag(1.5)出了问题,如下:Subscript indices must either be real positive integers or logicals.只要mag( matlab slice 函数,为什么例子也出错?matlab Help中关于slice作图函数,给出了一个例子然后我copy到命令行里,或者.m中试了试,结果就出来了这么个警告:Subscript indices must either be real positive integers or log matlab 运行下面的程序出现一些错误,请帮忙看看错误在哪里,谢谢.程序syms x n mn=0;m=1377*10^6;x=0.1:0.01:6;f(x)=(x.*19.1*300*300*pi.*(1-(sin(2*pi.*x))/(2*pi.*x))-n)/((3*x-1.25)*360);plot(x,f(x))运行出错? Subscript indices m MATLAB求解多项式的问题从书上直接抄的两行p=[1 -2 0 25 116]r=roots(p)运行之后居然报错subscript indices must either be real positive integers or logicals.我的版本是7.8.0(R2009a),不知道和这个有没有关系 matlab 函数自变量不能从零开始load Txfdwx(x,y,t) = Txf(i-1,j-1,t);%改变时间值可以画出不同时间的等温线zhb=contour(dwx(50));clabel(zhb)由于i =1:19,j=1:19之后运行说Subscript indices must either be real positive intege 关于Matlab的问题t=1:0.5:50;if t>=0&t10&t20&t30v(t)=1520*e^(-0.2*(t-30));else v(t)=0;endplot(t,v(t))Subscript indices must either be real positive integers or logicals.我想问问这个到底发生什么问题了,需要怎么改? matlab问题 sin[a(t-t0)] -------------- a(t-t0) 要求是做图a=2;t0=1;t=1:0.1:10;y=sin(a*(t-t0))/a(t-t0);老是出现 Subscript indices must either be real positive integers or logicals.怎么回事啊虚线部分是除的意思 这段matlab代码错在哪里了出现这个错误:Subscript indices must either be real positive integers or logicals.D是一个9*9邻接矩阵,这段代码想把邻接矩阵的边保存到一个2列矩阵L中,L的每一行存储一条边的两 matlab这个式子哪里出问题了?v=2*0.89*0.6*l((h-0.6)/(2*0.6).*sqrt(1-((h-0.6)/0.6).^2)+0.5*asin((h-0.6)/0.6)+pi/4);l是常数 赋值过了 h是列向量错误说:Subscript indices must either be real positive integers or logicals. 之后的运行又出现:Subscript indices must either be real positive integers or logicals[f,r]=meshgrid(500:10:1500,0.015:0.00020:0.035);a1=0.01;%孔半径ua=1;%空气柱振速w=2*pi.*f;c=340;%声速k=w./c;%a=0;%位置点的x坐标b=0.015;%位