필터 지우기
필터 지우기

Finding time with nested loops

조회 수: 1 (최근 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 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