Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This problem will introduce you the MATLAB (if you have not used it before).In this problem you will use MATLAB to accomplish the following tasks:

This problem will introduce you the MATLAB (if you have not used it before).In this problem you will use MATLAB to accomplish the following tasks:

(a) Write a function rho2h.m which, given density () in slugs per cubic feet returns altitude (h) in feet above sea level (assuming a standard atmosphere).

(b) Make a plot of time versus density data for a rocket in flight. The data the you will plot is given in the m-script skeleton listed below. Time is in the vector t and density is in the vector rho. The point of this task is make sure you know how to generate professional looking plots using MATLAB.

(c) Use the function you developed in part(a) to generate a second plot of time versus altitude for the same rocket.

To get you started, a skeleton of the m-script that will do this has been been provided below. Type it up in the MATLAB editor and save it as an m-script named aem2301_ps_pr_2.m. Then write a function rho2h.m and save it in the same directory you saved aem2301_ps_pr_2.m. Then run aem2301_ps_pr_2.m from the MATLAB command line. The result should be the two plots you are asked to make. The plots generated are going to very plain. You are expected to make them look more professional along the lines we discuss in class. Turn in the two plots and the listing of rho2h.m.

Code for aem2301_ps_pr_2.m:

% Clear memory and work space clear all; close all; clc; % Time and density history for the launch and ascent of a rocket t = [0 10 20 30 40 50 60 70 80 90 100]; % Time in seconds since launch rho = (1e-3)*[2.377 2.208 2.010 2.0624 2.1149... 2.1673 2.2197 2.2721 2.3246 2.3770 2.377]; % Density in slugs/ft^3 % Loop through t and density to calculate altitude number_of_data_points = length(t); for k=1:number_of_data_points h(k) = rho2h(rho(k)); % You will have to write this function rho2h(density); end % Plot figures figure(1) plot(t,rho,'r-');grid on;xlabel('Time');ylabel('Density (slugs/ft^3)'); figure(2) plot(t,h,'r-');grid on;xlabel('Time');ylabel('Altitude (ft)');

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions