Finding time with nested loops

1 次查看(过去 30 天)
Feynman
Feynman 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 CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by