MATLAB程序错误?Subscript indices must either be real positive in
来源:学生作业帮 编辑:搜狗做题网作业帮 分类:综合作业 时间:2024/05/24 00:12:40
MATLAB程序错误?Subscript indices must either be real positive integers or logicals.
>> for i=1:1:100
x(i)=x(i-1)+vx(i)*1
y(i)=y(i-1)+yx(i)*1
r(t)=sqrt(x(i)^2+y(i)^2)
ax(i)=-G*M*x(i)/r(i)^3
ay(i)=-G*M*y(i)/r(i)^3
vx(t+1)=vx(t)-ax(i)*1
vy(t+1)=vy(t)-ay(i)*1
end
>> for i=1:1:100
x(i)=x(i-1)+vx(i)*1
y(i)=y(i-1)+yx(i)*1
r(t)=sqrt(x(i)^2+y(i)^2)
ax(i)=-G*M*x(i)/r(i)^3
ay(i)=-G*M*y(i)/r(i)^3
vx(t+1)=vx(t)-ax(i)*1
vy(t+1)=vy(t)-ay(i)*1
end
由于你的i和j是从1开始的,而是用中用到了i-1和j-1此时为0,但matlab得下标只能是正整数,所以报错
MATLAB程序错误?Subscript indices must either be real positive in
matlab :Subscript indices must either be real positive integ
matlab 出现Subscript indices must either be real positive inte
MATLAB出现?Subscript indices must either be real positive inte
matlab出现? Subscript indices must either be real positive int
? Subscript indices must either be real positive integers or
Subscript indices must either be real positive integers or l
用matlab图像配准中出现Subscript indices must either be real positive
问一下在matlab中出现Subscript indices must either be real positive
MATLAB里出现Subscript indices must either be real positive inte
matlab为什么出现 Subscript indices must either be real positive i
之后的运行又出现:Subscript indices must either be real positive inte