i am getting error in the plot function it says array indices must be +ve int or logical value
显示 更早的评论
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 个评论
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
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Support Vector Machine Regression 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
