Display the integral value calculated for distance, the number of sections used in the numerical integration.
Assignment Brief
EG-264 - MATLAB Coursework
Basic details
You are asked to submit your MATLAB solution to the problems specified below. A professional presentation of your solution is required. This should contain:
- A cover page giving your name and your student number and including the signed statement "I confirm that I have not received help from, or given help to, anyone else in constructing the solution to this assignment".
- A brief description of the problem and of the process you have followed to produce your solution.
- A complete documented listing of your actual MATLAB files (i.e. NOT retyped by you and NO screenshots).
- A listing of the actual output from MATLAB giving the answers requested (i.e. NOT retyped by you and NO screenshots).
- Appropriate referencing to any publication or web based material that you have used in constructing your solution.
Question 1:
Figure 1 shows the speed (mph) against time(s) graph of a Camaro car accelerating from a standing start. Over 25 seconds the car accelerates to nearly 150mph.
Figure 1: Speed (mph) vs. Time(s) graph of a 2010 Camaro’s data measurements. To reproduce the speed and time data from the image, combine equations (1), (2) and (3) using for loops and conditional statements. When t < 5 s, the speed of the car in mph can be determined using Equation (1): Speed(t) = 0.1553567(t6 ) - 2.0416(t5 ) + 9.1837(t4 ) – 14.829(t3 ) - 1.3703(t2 ) + 32.821(t) - 1.3155 (Eqn. 1) When ππ ≤ π < ππ. ππ, the speed of the car in mph can be determined using Equation (2): Speed(t) = 0.003980879(t5 ) – 0.2247(t4 ) + 4.8682(t3 ) – 50.442(t2 ) + 254.67(t) - 430.66 (Eqn. 2) When t ≥ 15.4s, the speed of the car in mph can be determined using Equation (3): Speed(t) = -0.073(t2 ) + 6.1802(t) + 40.423 (Eqn. 3)
To determine the distance travelled by the Camaro, numerical integration can be used on the reproduced speed vs. time data, calculating the area under the curve
Use the composite trapezoidal rule to obtain an approximation of the distance travelled by the Camaro in metres, with a relative error of less than 0.00002%. During the numerical integration calculations, if the relative error is not reached, double the number of separations used over the timespan in the calculations for the following calculation
- (i) In the command window, display the integral value calculated for distance, the number of sections used in the numerical integration, and the relative error produced for each looped calculation using ‘fprintf’ and associated commands.
- (ii) Produce a single figure with two subplots, (1) showing the speed (m/s) vs. time (t) of the combined speed equations in one plot at a reasonable accuracy, and (2) a cumulative distance (m) graph of the Camaro over time(s) in the second subplot.
- (iii) Produce a figure showing the total distance calculated against the number of separations used in each numerical integration calculation; use a logarithmic x-axis scale on the resulting plot.
Question 2:
An undamped system is harmonically excited using an external forcing frequency π, which produces vibration of the system. The displacement of the system over time (x(t)) can be calculated using Equation 4, when using the parameter values detailed in Table 1.
The acting driving frequency π however is unknown.
- (i) Use the bisection method to determine an approximation of the value of π, with an absolute error of less than 1 × 10−6 ;whenthe displacement x = 0.0386m, at time t = 4.54s, limiting the useable values of π between: 5.12 < π < 6.45. Display the resulting value of π, and the absolute error obtained.
- (ii) Produce a plot of the displacement x(t), between 0 < π‘ < 6π , using the driving frequency π calculated in part (i).
Sample Answer
MATLAB Coursework Report – EG-264
Declaration:
“I confirm that I have not received help from, or given help to, anyone else in constructing the solution to this assignment.”
Introduction
This coursework addresses two MATLAB programming tasks related to engineering problems. The first task involves numerically integrating a speed-time graph for a Camaro car using the composite trapezoidal rule to estimate distance travelled. The second task involves solving for an unknown driving frequency (ω) using the bisection method, applied to a harmonic vibration system.
Question 1 – Camaro Speed and Distance Analysis
Problem Description
The speed-time behaviour of a Camaro over 25 seconds is described using three piecewise equations. The aim is to calculate the distance travelled by numerically integrating the speed data with very high accuracy (relative error < 0.00002%). This is achieved using composite trapezoidal integration. Additionally, graphical plots of speed vs. time, cumulative distance, and distance vs. separations are required.
Approach Summary
-
Define the time vector and apply conditional logic to compute speed using the appropriate equation in each time range.
-
Convert speed from mph to m/s.
-
Use a loop to apply the trapezoidal rule, increasing the number of sections (n) until the relative error goal is met.
-
In each loop, fprintf is used to display:
-
Generate the required plots:
Question 2 – Harmonic Vibration and Bisection Method
Problem Description
An undamped harmonic system`s displacement equation is provided. The driving frequency ω is unknown, but the displacement at a specific time is known. Using the bisection method, we need to find ω to a precision of absolute error < 1 × 10β»βΆ. After that, we plot x(t) over 0–6 seconds using the calculated ω.
Approach Summary
-
Define the displacement function x(t, ω).
-
Apply the bisection method between ω = 5.12 and 6.45, with stopping condition |error| < 1e-6.
-
Display the resulting value of ω and error.
-
Use ω to calculate x(t) for t = 0 to 6 seconds and plot x vs. t.
Continued...
100% Plagiarism Free & Custom Written,
tailored to your instructions