Array indices must be positive integers or logical values.
显示 更早的评论
it says the error is on line 13
s(t)=[0.1553567*(t^6)-2.0416*(t^5)+9.1837*(t^4)-14.829*(t^3)...
-1.3703*(t^2)+32.821*(t)-1.3155];
and I'm trying to make a loop to plot a graph for this https://screenshotscdn.firefoxusercontent.com/images/1a144e46-fb07-4a6c-9757-1788e9a3adfe.png so if you notice any errors please let me know
2 个评论
Image Analyst
2018-11-27
Original question, so it will be here when he tries to edit it away:
It says the error is on line 13
s(t)=[0.1553567*(t^6)-2.0416*(t^5)+9.1837*(t^4)-14.829*(t^3)...
-1.3703*(t^2)+32.821*(t)-1.3155];
and I'm trying to make a loop to plot a graph for this My Picture so if you notice any errors please let me know.
Walter Roberson
2018-11-27
The screenshot URL is no longer valid.
回答(1 个)
John D'Errico
2018-11-4
编辑:John D'Errico
2018-11-4
What is t? You may think you are creating a function by doing this:
s(t)=[0.1553567*(t^6)-2.0416*(t^5)+9.1837*(t^4)-14.829*(t^3)...
-1.3703*(t^2)+32.821*(t)-1.3155];
But that is not how MATLAB syntax works.
In fact, MATLAB does not understand what you want. Instead, it think that s is a variable, and t is an index. is t an integer vector or array? (Clearly not, else you would not have gotten that error message.)
So, MATLAB tries to assign the element s(t), but if t is not something can be used to index, then MATLAB gets confused.
2 个评论
Walter Roberson
2018-11-4
Assign to s(t+1)
I recommend that you experiment with 5>=t<15.4 as it seems unlikely to be what you want at that point.
类别
在 帮助中心 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!