Can you please use MATlab to write the script?
EGR 150 A4_HW Problem: A spacecraft was launched from a transport airplane at 45,000 feet and reached a maximum altitude of 100 km. It then descended to sea level. The retro rockets failed and the craft continued to gain speed until it crashed into the water. As part of the post-flight analysis you are asked to write a MATLAB script that calculates the 1. Initial spacecraft velocity in m/s 2. Time to reach the highest altitude in s 3. Terminal velocity at the sea level in m/s 4. Time to descend from the highest altitude to the seal level in seconds 2 21 20 Fig. 1 showing the initial (1) and final (2) positions of the spacecraft in the ascent phase. Background: Conservation of energy: A particle that experiences only conservative forces and no frictional forces, has a potential energy (PE) associated with each force, and the energy only changes between kinetic energy (KE) and various types of PE. The total energy. E, of the particie is constant E = KE+PE=constant. For the spacecraft scenario described above, you will first be considering the change in its kinetic energy (AKE ) and the change in potential energy (APE ) between its initial launch state (1) and the maximum altitude (2). These changes are related by AKE=KE, -KE, -- (PE, -PE)=- APE. Assuming an initial velocity w, and noting that at the maximum altitude, the velocity=0) we can write the energy changes in the form: mva = mgh 2 or Vo = 2gh Here h=22-2, is the vertical distance travelled from launch to the maximum altitude. The z. axis of the coordinate system points vertically up and is at sea level (See Fig. 1) EGR 150 Homework 1 The change of velocity during flight is then: v(t) = Vogt Therefore - Volg t is the time taken to reach the maximum altitude (at which point v=0). The same approach can be applied to the descent phase of the flight from the highest altitude to the sea level: mvant = mgz2 2 In your script: Your script name must comply with the following format: LastName_First_Name_A4_HW.m Download and use the script template Include commentary with your name and explanations Include commands clear and clc Use input function which prompts to enter the initial altitude in feet and the maximal altitude in km Include a local function, which converts distance from feet to m Print required variable names and their values with 2 digits after decimal point using fprintf function Submit your m-file on Canvas