フィルターのクリア

Finding time with nested loops

2 ビュー (過去 30 日間)
Feynman
Feynman 2013 年 11 月 5 日
回答済み: Image Analyst 2013 年 11 月 5 日
I am given a task to do in matlab where using nested loops, I am supposed to determine the amount of time spent above 50,000 feet as a function of the burn time (b) and thus as a function of the fuel mass (qb). The rocket's maximum fuel load is 100 slugs and the maximum value of b is 100/q = 100. I am to use the given the equations
v(t) = uln(m0/m0-qt)-gt h(t) = u/q(m0-qt)ln(m0-qt)+u(lnm0+1)t-gt^2/2-(m0*u/q)*ln(m0)
m0 = rocket's initial mass q = rate at which the rocket burns fuel mass u = is the exhaust velocity of the burned fuel relative to the rocket g = acceleration due to gravity b = burn time thus, rocket mass without fuel is
m(e) = m0 - qb
For t>b, v(t) = v(b)-g(t-b) h(t) = h(b)+v(b)(t-b)-g(t-b)^2/2
To find peak height hp = h(b)+v^2(b)/(2g) Time for rocket to hit the ground t(hit) = tp + ((2hp/g)^(1/2)) I am given me,q,u and g in a data table and have imported them with their respected variable names in my script. My question is how would I set up nested loops utilizing the equations given to me to solve the problem? I thought about using the for loop but cannot see a way of setting it up properly.
  1 件のコメント
Jan
Jan 2013 年 11 月 5 日
As usual for homework questions: Please show us, what you have tried so far and try to ask a specific question.

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

回答 (1 件)

Image Analyst
Image Analyst 2013 年 11 月 5 日
Try tic and toc, or timeit().

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by