0
我用下面的代碼:「無效索引」錯誤的Scilab
for t = linspace(0,2,500)
x(t) = 1+ t^2;
y(t) = 2*t;
r(t) = sqrt((x(t))^2+(y(t))^2);
radius = 1.6
if r(t) > 0.999*radius & r(t) < 1.001*radius then
solucion = t;
end
end;
disp(solucion, "the solution is:")
的正常工作與t
> 1,不同的半徑值。
,但我得到error 21: Invalid index
時t
取0和1之間
我需要這些值以及工作價值觀。我該如何處理?
如果這個工程像MATLAB一樣,你只能用正整數索引東西。使用一個數組(例如'0:0.01:1')並用循環變量訪問它,這是整數 – Adriaan