matlab :Subscript indices must either be real positive integers or logicalsn(1)=1;n(2)=2;n(3)=3;n(4)=4;n(5)=1;h(1)=0.02;h(2)=0.03;h(3)=0.04;for i=1:3;sita(1)=1; sita(i+1)=asin(sin(sita(i))*n(i)/n(i+1));cos(sita(i))=(1-sin(sita(i))^2)^0.5;f=1.6e10;n

来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/25 14:30:49
matlab:Subscriptindicesmusteitherberealpositiveintegersorlogicalsn(1)=1;n(2)=2;n(3)=3;n(4)=4;n(5)=1;

matlab :Subscript indices must either be real positive integers or logicalsn(1)=1;n(2)=2;n(3)=3;n(4)=4;n(5)=1;h(1)=0.02;h(2)=0.03;h(3)=0.04;for i=1:3;sita(1)=1; sita(i+1)=asin(sin(sita(i))*n(i)/n(i+1));cos(sita(i))=(1-sin(sita(i))^2)^0.5;f=1.6e10;n
matlab :Subscript indices must either be real positive integers or logicals
n(1)=1;
n(2)=2;
n(3)=3;
n(4)=4;
n(5)=1;
h(1)=0.02;
h(2)=0.03;
h(3)=0.04;
for i=1:3;
sita(1)=1;
sita(i+1)=asin(sin(sita(i))*n(i)/n(i+1));
cos(sita(i))=(1-sin(sita(i))^2)^0.5;
f=1.6e10;
namta=3e8/f;
fai=(4*pi/namta)*n(i)*h(i)*cos(sita(i));
Mt=[];
Mt(1,1)=cos(fai);
Mt(1,2)=-sqrt(-1)*sin(fai)/n(i);
Mt(2,1)=-sqrt(-1)*sin(fai)*n(i);
Mt(2,2)=cos(fai);
M=[1 0;0 1];
Mt=M*Mt;
end
H=[1 n(4)];
Y=Mt*H;
K=Y(2)/Y(1);
r=(n(1)*cos(sita(1))-K*cos(sita(i+1)))/(n(1)*cos(sita(1))+K*cos(sita(i+1)));
T=1-r^2;
错误提示:
Subscript indices must either be real positive integers or logicals.
Error in sanceng (line 22)Mt(1,1)=cos(fai);
这个程序要怎么改啊 这行就没下标啊

matlab :Subscript indices must either be real positive integers or logicalsn(1)=1;n(2)=2;n(3)=3;n(4)=4;n(5)=1;h(1)=0.02;h(2)=0.03;h(3)=0.04;for i=1:3;sita(1)=1; sita(i+1)=asin(sin(sita(i))*n(i)/n(i+1));cos(sita(i))=(1-sin(sita(i))^2)^0.5;f=1.6e10;n
n=[1 2 3 4 1];h=[0.02 0.03 0.04];
for i=1:3;
sita(1)=1;
sita(i+1)=asin(sin(sita(i))*n(i)/n(i+1));
sita(i)=acos((1-sin(sita(i))^2)^0.5); %用反余弦
f=1.6e10;namta=3e8/f;
fai=(4*pi/namta)*n(i)*h(i)*cos(sita(i));
Mt=[];
Mt(1,1)=cos(fai);
Mt(1,2)=-sqrt(-1)*sin(fai)/n(i);
Mt(2,1)=-sqrt(-1)*sin(fai)*n(i);
Mt(2,2)=cos(fai);
M=[1 0;0 1];
Mt=M.*Mt; %这里要用点乘
end
H=[1 n(4); 1 1]; %这里要将 H 定义为 2x2 矩阵
Y=Mt.*H; %用点乘
K=Y(2)/Y(1);
r=(n(1)*cos(sita(1))-K*cos(sita(i+1)))/(n(1)*cos(sita(1))+K*cos(sita(i+1)));
T=1-r^2;

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. “subscript out of subscript out of range 是什么? 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 Run-time error'9':subscript out of Subscript indices must either be real posit... matlab slice 函数,为什么例子也出错?matlab Help中关于slice作图函数,给出了一个例子然后我copy到命令行里,或者.m中试了试,结果就出来了这么个警告:Subscript indices must either be real positive integers or log matlab中,built in function是什么意思? 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仿真老是出现错误,请问怎么改?clear;clc;deta=2;w=2.5;theta=0;a=linspace(-10,10,25);b=linspace(-1.0,1.0,25);[x,y]=meshgrid(a,b);s(x,y)=exp(-0.5*((x/deta)^2+(y/deta)^2)).*sin(w*(x*cos(theta)+y*sin(theta)));plot3(x,y,s(x,y)); Subscript 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的每一行存储一条边的两