"Index must be a positive integer or logical" error in my function to calculate velocity from acceleration
Show older comments
When I try to run this function:
function [time,velocity] = velocity(rocket,chutea,chuteb)
[t,a,drag] = calculateAcceleration(rocket,chutea,chuteb,0.1);
v = 0;
for k = 2:0.1:100; % Defined range for time
v(k) = v(k-1) + (a(k-1)*0.1);
end
maximumveloc = max(v)
end
I get the following error message:
Attempted to access veloc(1.1); index must be a positive integer or logical.
Error in Q3_11013011 (line 13)
veloc(k) = veloc(k-1) +
(a(k-1)*0.1);
4 Comments
Jan
on 31 Jan 2013
@author: Wow, I find it very annoying, if a question is deleted after a voluntary contributor spent time for posting a useful answer. Without the text of the question, the answer is useless for the community and the time and energy for creating the answer is stolen. This is massively unfriendly and it surely reduces the motivation to answer.
Here the author even changed the login name. I do not have any problems with solving questions apart from this forum. But then a fair payment with real money is obviously the correct strategy.
@Randy: I do not see any method to make such obfuscations impossible. But I do not think that a parasitic behaviour should be tolerated. Perhaps there is some space in the layout to include a mativating slogan like: "Think twice if you are acting like you want others to act in a public forum" or shorter: "pull yourself together".
Randy Souza
on 31 Jan 2013
I have restored the original text of this question.
1 1, this question has a clear subject and a thorough answer, so it may be valuable to someone else in the future. If you have a good reason why it should be removed from MATLAB Answers, please flag the question, explain why it should be deleted, and an administrator or high-reputation contributor will consider deleting the question. Please do not simply edit your question away.
On a slightly different topic, I think that if people were reminded on a verified email that they have to come back to "close" their threads (or to actively indicate that they could still use help), more people would at least come back and see what was answered/commented. I am saying that, because I really suspect that many people actually find some way to do what they want after posting the question, and never come back to check their threads. All of you folks who have been active here for a long time, have roughly a 1/3 ratio of accepted answers, but when I look at the threads it seems that a significant amount of the answers that were not accepted are just a consequence of people not coming back..
Randy Souza
on 31 Jan 2013
Edited: Randy Souza
on 31 Jan 2013
@Cedric: excellent idea; this is another enhancement that we are working on.
Thanks again!
Accepted Answer
More Answers (0)
Categories
Find more on Desktop in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!