Finding time with nested loops

5 Ansichten (letzte 30 Tage)
Feynman
Feynman am 5 Nov. 2013
Beantwortet: Image Analyst am 5 Nov. 2013
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 Kommentar
Jan
Jan am 5 Nov. 2013
As usual for homework questions: Please show us, what you have tried so far and try to ask a specific question.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Image Analyst
Image Analyst am 5 Nov. 2013
Try tic and toc, or timeit().

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by