Matlab - Subscript indices must either be real positive integers or logicals

 
Vista:

Subscript indices must either be real positive integers or logicals

Publicado por yusmary martinez (3 intervenciones) el 08/04/2018 13:23:13
Discupen me podrian deci que error tiene esto? este es el mensaje que aparece:Subscript indices must either be real positive integers or logicals.
como lo soluciono?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
%% runge kutta dos ecuaciones
x1=1
y1=0
h=0.05
t(1)=0;x(1)=x1;y(1)=y1
X=y
Y=0.1*(1-x^2)*y-x
for i=1
    t(i+1)=t(1)+i*h
    k(1)=h*x(t(i),x(i),y(i));
    l(1)=h*y(t(i),x(i).y(i))
    k(2)=h*x(t(i)+h/2,x(i)+k(1)/2,y(i)+l(1)/2);
    l(2)=h*y(t(i)+h/2,x(i)+k(1)/2,y(i)+l(1)/2);
    k(3)=h*x(t(i)+h/2,x(i)+k(2)/2,y(i)+l(2)/2);
    l(3)=h*y(t(i)+h/2,x(i)+k(2)/2,y(i)+l(2)/2);
    k(4)=h*x(t(i)+h,x(i)+k(3),y(i)+l(3));
    l(4)=h*y(t(i)+h,x(i)+k(3),y(i)+l(3));
    w(i+1)=x(i)+(1/6)*(k(1)+x*k(2)+x*k(3)+k(4));
    z(i+1)=y(i)+(1/6)*(l(1)+2*l(2)+2*l(3)+l(4));
end
plot(t,w,'r-',t,z,'b-')
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder