i am getting error in the plot function it says array indices must be +ve int or logical value
Mostrar comentarios más antiguos
v1(1)=2;
v2(1)=4;
v3(1)=-1;
for n = 1:50
a1(n)=v1(n)-v2(n);
v1(n+1)=v1(n)+a1(n)*0.1;
a2(n)=v3(n)-3;
v2(n+1)=v2(n)+a2(n)*0.1;
a3(n)=a1(n)-a2(n);
v3(n+1)=v3(n)+a3(n)*0.1;
end
t= 0:0.1:5;
plot(t,v1(t*10+1))
hold all
plot(t,v2(t*10+1))
plot(t,v3(t*10+1))
1 comentario
Why you want tp index v with t? you need not to do it while plotting.
The error is due to indexing. Array indices should be posititive integers in MATLAB. If you use ractions, you will get error.
A = rand(1,3) ;
A(0.5) % error
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Pie Charts en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
