lecture7RecursionReiterationE7part2

lecture7RecursionReiterationE7part2 - E7 Spring 2010:...

Info iconThis preview shows pages 1–12. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: E7 Spring 2010: Lecture 7 Raja Sengupta College of Engineering University of California Berkeley Can you plot the motion of a rocket? Rocket speed vs. time (during burn) speed t ( ) = exhaustSpeed *log fullMass mass ( t ) With gravity : speed t ( ) = exhaustSpeed *log fullMass mass ( t ) gt mass ( t ) = fullMass burnRate * t height ( t ) = exhaustSpeed *log fullMass mass ( ) t d g d t rocketTraj(20) Rocket speed vs. time (after burn) function [time,speed,height] = rocketTraj(fuelLoad) %fuelLoad in slugs %This program assumes the rocket starts from rest and goes %up vertically and falls back to earth the same way. %rocket parameters rocketMass = 100;%slug burnRate = 1;%slug/sec exhaustSpeed = 8000;%ft/sec: this is the effective fuel exit speed g = 32.2;%ft/sec/sec fullMass = rocketMass + fuelLoad; burnTime = fuelLoad/burnRate; timeGranularity = 0.01; maxCounter = (burnTime/timeGranularity)+1; %This loop computes the rocket speed and height upto the burn time for counter = 1:1:maxCounter, time(counter) = (counter-1)*timeGranularity; speed(counter) = exhaustSpeed*log(fullMass/(fullMass- burnRate*time(counter))) - g*time(counter); h1(counter) = exhaustSpeed*(fullMass - burnRate*time(counter))*log(fullMass - burnRate*time(counter))/burnRate; h2(counter) = exhaustSpeed*(log(fullMass)+1)*time(counter); h3(counter) = g*time(counter)^2; h4(counter) = fullMass*exhaustSpeed*log(fullMass)/burnRate; height(counter)= h1(counter) + h2(counter) - h3(counter) - h4(counter); end %This loop computes the rocket speed and height after the burn time while (ge(height(counter), 0)), counter = counter + 1; time(counter) = (counter-1)*timeGranularity; speed(counter) = speed(maxCounter) - g*(time(counter)-burnTime); height(counter) = height(maxCounter) + speed(maxCounter)*(time(counter) - burnTime) - g*((time(counter) - burnTime)^2)/2; end end Another cool link http://www.youtube.com/watch?...
View Full Document

Page1 / 28

lecture7RecursionReiterationE7part2 - E7 Spring 2010:...

This preview shows document pages 1 - 12. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online