Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MATLAB Question: You plan to launch a rocket that has the parameters provided below, you are to write a program that will calculate flight trajectory

MATLAB Question:

You plan to launch a rocket that has the parameters provided below, you are to write a program that will calculate flight trajectory without wind resistance. Your program is to utilize the finite difference approach for calculating trajectory parameters every 0.01 seconds until it hits the ground (negative elevation).

clear all close all

%Initial Conditions t(1)= 0.0; dt= 0.01; h(1)= 1; vel(1)= 0; mcase= 16; mfuel(1)= 134; BR= 4.8; fthrust(1)= 1560; Agravity=-9.81; vel(1)=0; Atotal(1)=0; ke(1)=0; pe(1)=0; te(1)=0;

i=1;

while h(i)>0 t(i+1)=t(i)+dt; mfuel(i+1)=max((mfuel(i)-(BR*dt))); mtotal(i+1)=mcase+mfuel(i+1); fthrust(i+1)=fthrust(i)*(mfuel(i+1)); Athrust(i+1)=((fthrust(i+1))/(mtotal(i+1))); Atotal(i+1)=Athrust(i+1)+Agravity; vel(i+1)=vel(i)+((Atotal(i+1)+Atotal(i))/2)*dt; h(i+1)=h(i)+((vel(i+1)+vel(i))/2); ke(i+1)=1/2*mtotal(i)*vel(i)^2; pe(i+1)=mtotal(i)*(Agravity)*h(i); te(i+1)=pe(i)+ke(i); i=i+1; end

subplot(2,2,1) plot(t,Atotal); grid title('Time vs. Acceleration') xlabel('Time (s)') ylabel('Acceleration (m/s^2)') pause(2)

subplot(2,2,2) plot(t,vel); grid title('Time vs. Velocity') xlabel('Time (s)') ylabel('Velocity (m/s)') pause(2)

subplot(2,2,3) plot(t,h); grid title('Time vs. Altitude') xlabel('Time (s)') ylabel('Altitude (m)') pause(2)

subplot(2,2,4) plot(t,mtotal); grid title('Time vs. Total Mass') xlabel('Time (s)') ylabel('Total Mass (kg)') pause(2) image text in transcribed

No matter what I change in the code I keep getting these four graphs, please help.

Also, I do not think this is meant to be done with a for loop.

These are what the graphs are meant to look like:

image text in transcribed

x 10 Pfme vs. Acceleration x 10303 Time vs. Velocity 2 2 0.5 0.5 1.5 Time (s) Time vs. Total Mass Time (s) 10302 Time vs. Altitude 15 150 E 10 3 100 D 50 0.5 10 20 Time (s) Time (s) Velocity: No Wind Resistance Acceleration: No Wind Resistance 100 6 50 100 150 0 100 150 0 time (seconds) Altitude: No Wind Resistance time (seconds) Total Mass: No Wind Resistance 150 10000 0 50 0 100 time (seconds) 150 0 150 100 time (seconds) 0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spomenik Monument Database

Authors: Donald Niebyl, FUEL, Damon Murray, Stephen Sorrell

1st Edition

0995745536, 978-0995745537

More Books

Students also viewed these Databases questions

Question

8. Explain the difference between translation and interpretation.

Answered: 1 week ago

Question

6. Explain the power of labels.

Answered: 1 week ago