# it is pretty important task please do it if you only can

# ME 106

# Homework 1

Angmering Raceway Car Jumping Simulation with** Graphical User Interface (GUI)**

Angmering Raceway is a motor racing circuit on the outskirts of Angmering, West Sussex in the

United Kingdom. Here is the Angmering Raceway website. Angmering Raceway – Oval Raceway at Angmering, West Sussex

** **

** **

One of the Angmering Raceway Car Jumping Competitions is in the following YouTube Video.

https://www.youtube.com/watch?v=vPqIh3HlHA8

** **

The objective of the car jump competition is to drive over a **7 m long (horizontally) and 1.5 m high (vertically) jump ramp** and **jump over** 9 cars parked tightly side-by-side, approximately 1.8 m x 9 = **16.2 m long distance**.

Car jumps utilize **the slop of the ramp** and **fast speed** to create a catapult effect that launch the car into the air at an angle like a catapult. Since the slop of the ramp is fixed, the distance of the jump will be determined by the velocity of the car when it jumps off the ramp.

Car repairs can be time consuming and expensive. Write a **MATLAB App Designer** app using

**Graphical User Interface (GUI)** to help the race driver to visualize the jump and simulate the result.

Add an **Axes** to show a **picture** of the **race car** in GUI when the app starts ** ^{[2 pt]}**.

Add another **Axes** in GUI to** plot the jump ramp and parked cars **in GUI when the app starts ** ^{[2 pt]}**.

# 1. The jump ramp is 7 meters long (measured horizontally) and 1.5 meters tall (measured vertically). Create a new variable to store the jump ramp x-direction coordinates, 0 and 7 ^{[1pt]}. Create another new variable to store the jump ramp y-direction coordinates, 0 and 1.5

**[1pt]**.

- The tightly parked cars (for the race drivers to jump over) are
**16.2 meters long and 1.5 meters high**. Create a new variable to store the**parked cars x-direction coordinates**, 7, 7, (7+16.2), and (7+16.2). Create another variable to store the^{[1 pt]}**parked cars y-direction coordinates**, 0, 1.5, 1.5, and 0.^{[1 pt]}

# 3. Plot the jump ramp ^{[2 pt]} and the tightly parked cars ^{[2 pt]}.

- Set
**XLim**to [0 35]. Set^{[1 pt]}**YLim**to [0 25].^{[1 pt]} - Add plot
**title**,^{[2 pt]}**x-axis label**,^{[1 pt]}**y-axis label**, and^{[1 pt]}**legend**to the plot.^{[2 pt] }

Add a **Label** in GUI to show the race driver the current **car speed in MPH **** ^{[2 pt]}**. The label should show

**0**

**MPH**when the app starts

**.**

^{[2 pt]}

Add a **speedometer** **Gauge** in GUI to show the race car in **MPH **** ^{[2 pt]}**. The gauge should point to

**0 MPH**when the app starts

**.**

^{[2 pt]}

Add a **start** **Button** in GUI ** ^{[2 pt] }**for the race driver to click to

**start the simulation**and to

**start**

**speeding up the car**. When this

**start**

**Button**is clicked, the app should:

- Modify the
**picture of the race****car**to show another picture.^{[2 pt]} - Increment the text shown in the car speed
**label**by 1 MPH every 0.2 seconds (200 milliseconds).^{[2 pt]} - Increment the
**gauge**value by 1 MPH every 0.2 seconds (200 milliseconds).^{[2 pt]}

Add a **Jump** **Button** in GUI ** ^{[2 pt]}** for the race drive to

**click when the car reaches the desired jump speed**. When this

**Jump**

**Button**is clicked, the app should:

- Stop the car speed increment of the text shown in the car speed
**Label**.^{[2 pt]} - Stop the increment of the
**Gauge**value.^{[2 pt]} - Take the current car speed value in MPH from the
**Gauge**and use the value for the simulation computation.^{[2 pt]}

# 4. Convert the car speed from miles per hour (mph) to meters per second (m/s) ^{[2 pt]}.

# 5. Compute the jump ramp incline angle ^{[2 pt]}.

# 6. Compute the initial velocity of the car in the x ^{[2 pt]} and y ^{[2 pt]} directions (v_{x0} and v_{y0}).

- Compute the
**time**it takes for the car to reach the maximum height (**v**= 0) using_{y}**v**_{y}= v_{y0}+ a_{y}t

**[2 pt]**.

# 8. Compute the maximum height ^{[2 pt]} using y = y_{0} + v_{y0}t + ½ a_{y} t^{2}.

# 9. Compute the time it takes for the car to free-fall (with zero initial velocity) from the maximum height to the ground ^{[2 pt]}, using y = y_{0} + v_{y0}t + ½ a_{y} t^{2}.

- Compute the
**total flight time**of the projectile, the^{[2 pt]}**time**it takes for the car to reach the maximum height**plus**the**time**it takes for the car to free-fall from the maximum height to the ground. - Use the MATLAB
**linspace**function to generate**a large array of time**that starts at**0**and ends at the**total fly time**with**100****equally spaced time points**.^{[2 pt]}

# 12. Compute a large array of x ^{[2 pt]} and another large array of y ^{[2 pt]} values by applying elementby-element computation to the large array of time.

# 13. The jump ramp is 7 meters long (measured horizontally) and 1.5 meters tall (measured vertically). Create a new variable to store the jump ramp x-direction coordinates, 0 and 7 ^{[1pt]}. Create another new variable to store the jump ramp y-direction coordinates, 0 and 1.5

**[1pt]**.

- The tightly parked cars (for the race drivers to jump over) are
**16.2 meters long and 1.5 meters high**. Create a new variable to store the**parked cars x-direction coordinates**, 7, 7, (7+16.2), and (7+16.2). Create another variable to store the^{[1 pt]}**parked cars y-direction coordinates**, 0, 1.5, 1.5, and 0.^{[1 pt]}

# 15. Use element-by-element addition to add the length of the jump ramp (7 m) to every value in the large array of x projectile motion coordinates ^{[2 pt]}.

# 16. Now we are ready to prepare the coordinates for the top of the race car. The race car is 1.5 meters tall. The x-direction coordinates for the top of the race car can be obtained from combining the jump ramp x-direction coordinates and the new x-direction projectile coordinates together into a new array ^{[2 pt]}. The y-direction coordinates for the top of the race car can be obtained from combining the jump ramp y-direction coordinates + 1.5 and the y-direction projectile coordinates + 1.5 together into a new array ^{[2 pt]}.

# 17. Plot the jump ramp ^{[2 pt]}, the tightly parked cars ^{[2 pt]}, the bottom of the race car projectile motion ^{[2 pt]} and the top of the race car projectile motion ^{[2 pt]} in the same figure.

- Set
**XLim**to [0 35]. Set^{[1 pt]}**YLim**to [0 25].^{[1 pt]} - Add plot
**title**,^{[2 pt]}**x-axis label**,^{[1 pt]}**y-axis label**, and^{[1 pt]}**legend**to the plot.^{[2 pt]}

# 20. Multiply the time it takes for the car to reach the maximum height by 2 to obtain the time the race car flies above 1.5 m ^{[2 pt]}.

# 21. Compute the horizontal distance the race car flies above 1.5 m using x = x_{0} + v_{x0}t + ½ a_{x} t^{2}. Recall that a_{x} = 0 ^{[2 pt]}.

# 22. If the horizontal distance the race car flies above 1.5 m value is greater than 16.2 ^{[2 pt]}:

- Modify the
**picture of the race****car**to show a successful picture.^{[2 pt]}

# 23. Else:

- Modify the
**picture of the race****car**to show a crash picture.^{[2 pt]} **End**.

Additional components are always welcome!

(Here is an example display when the program starts.)

(Here is an example display after clicking the START+SPEED button. Note that the speed goes up automatically.)

(Here is an example display showing the speed automatically goes up.)

(Here is an example clicking the JUMP button at 56 MPH.)

(Another example for clicking the JUMP button at 39 MPH.)

# Ensure your hw1 folder contains all files.

# Include all the pictures used in hw1 GUI in the same folder.

# Zip the entire hw1 folder.

# Rename the hw1.zip to LastName_FirstName_ME106_hw1.zip Submit the .zip file to Moodle.