Anyone could help me solving this problem or could you refer me to any video or link that can help. I have been trying to solve it for couple of hours. Your help will be appreciated.

1 回表示 (過去 30 日間)
  8 件のコメント
Wasi von Deutschland
Wasi von Deutschland 2017 年 5 月 20 日
should be t=t+delta_t....? but my Auto grader says it's incorrect
Walter Roberson
Walter Roberson 2017 年 5 月 20 日
If your auto grader is saying that your existing version is correct, then go with your existing version. If your auto grader is saying that your existing version is incorrect, then perhaps you have more than one problem, with the reverse time being one of them.

サインインしてコメントする。

回答 (1 件)

Walter Roberson
Walter Roberson 2017 年 5 月 21 日
You have
theta = a0;
while theta==0;
Your input, a0, is said to be a positive number less than pi. As it is a positive number, the test theta == 0 will fail, so the body of
while theta==0
is never going to execute.
I suggest you consider theta>0 instead of theta==0
  22 件のコメント
Wasi von Deutschland
Wasi von Deutschland 2017 年 5 月 26 日
Roberson could you please tell me when autograder used arguments 0,1 it makes mistake for other arguments it's perfect.
Walter Roberson
Walter Roberson 2017 年 5 月 26 日
Your code appears to return 4e-6 when called with argument 0, 1. That is a completely reasonable answer for the method of calculation that you are directed to use.
It is not a fair question: although the theoretic answer is that a pendulum of length 0 has infinite velocity and 0 period, it is also the case that a pendulum of length 0 is a point source and so cannot be said to move through any angle. Your given task is not to calculate the theoretical answer but rather to simulate the movement, and simulation requires a minimum of one time-step.
Their description of the calculation specifically talks about counting until the pendulum has "passed through" its lowest point, and if you can say with any assurance that the pendulum is "at" 1 radian then it takes a time-step to evolve to be "at" any other angle. If a pendulum of length 0 is "at" 1 radian at time 0, then no seconds later it cannot have changed to be "at" a different angle. If you want to talk about a 0 length pendulum then you would have to say that the angle is undefined, which would correspond to pendulum(1, nan) and your code returns 0 for that.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeGeneral Physics についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by