Assignment title: Management


Q 8 The following table shows the output of a 'cos' function. 1. Use linear and spline interpolation to estimate the value of Y when X=pi/3 2. Plot the data, the two interpolation methods and the cos function for the range of X values in the table 3. Compare the estimates to the true value cos(pi/3)=0.5 4. Comment on the accuracy of the different methods X Y 0.5 0.8823 0.7 0.7287 0.9 0.5865 1.1 0.4293 1.3 0.3016 1.5 0.0462 Submit your solution as m-files Q9 Suppose you have analysed the price behaviour of a certain stock by plotting the scaled frequency histogram of the price over a number of months. Suppose that the histogram indicates that the price is normally distributed with a mean $100 and a standard deviation of $5. Write a MATLAB program to simulate the effects of trading on the stock exchange. On each trading day, the price is a random value that is sampled from the normal distribution that was defined. (Note that this doesn't truly model the behaviour of the stock exchange: the price is a stochastic process, not a random process. A stochastic process includes some memory of the previous value, so it is almost impossible to jump from very low to very high.) The rules for trading are: 1. Buy 50 shares of the stock if the price is less than the $100 mean 2. Sell all shares if the price is more than one standard deviation above the mean (i.e. > $105) Analyse the outcome of this strategy over 250 days (the approximate number of trading days in a year). Define the profit as the yearly income from selling stock plus the value of the stock you own at year's end, minus the yearly cost of trading stock. Compute: 1. the mean yearly profit you would expect to make, 2. the minimum expected yearly profit, 3. the maximum expected yearly profit, and 4. the standard deviation of the yearly profit. The broker charges 6 cents per share bought or sold with a minimum fee of $40 per transaction. Assume that you make only one transaction per day. Submit your solution as m-files Q 10 A certain object moves with the v(t) given in the table below. 1. Plot the object's position across the range of time given that the object was initially 3m from the origin. 2. Plot the object's acceleration as a function of time. 3. Return to the Command Window the object's position after 10 s. 4. Return to the Command Window the acceleration at 5 s using the central difference method. Time (s) Velocity (m/s) 0 0 1 2 2 5 3 7 4 9 5 12 6 15 7 18 8 22 9 20 10 17 Submit your solution as m-files Q 11 Question 1 The equation of motion of a rocket-propelled sled is, from Newton's law, where m is the sled mass, f is the rocket thrust, and c is the air-resistance coefficient. Suppose that m = 1000 kg and c = 500 N.s/m. Suppose also that v(0) = 0 and f = 75 000 N for t ≥ 0. Determine the speed of the sled at t = 10 s. Use Euler's method and report your answer to the Command Window along with the chosen timestep Δt and why that value of Δt was chosen. Question 2 The equation of motion for a pendulum whose base is accelerating horizontally with an acceleration a(t) is Suppose that g = 9.81 m/s2, L = 1 m, and . Plot θ(t) for 0 ≤ t ≤ 10 s for the following three cases, using one of the MATLAB ode solvers: 1. The acceleration is constant: a = 5 m/s2, and θ(0) = 0.5 rad. 2. The acceleration is constant: a = 5 m/s2, and θ(0) = 3 rad. 3. The acceleration is linear with time: a = 0.5t m/s2, and θ(0) = 3 rad. Submit your solution as m-files Q12 Submit your Simulink solutions to the following questions: Question 1 The equation of motion of a rocket-propelled seld is, from Netwons's law, where m is the sled mass, f is the rocket thrust, and c is air resistance coefficient. Suppose that m =1000 kg and c = 500 N.s/m. Suppose also that v(0) = 0 and f = 75 000 N for t ≥ 0. Determine the speed of the sled at t = 10 s. Use Euler's method and report your answer to the Command Window along with the chosen timestep Δt and why that value of Δt was chosen. Question 2 The equation of motion for a pendulum whose base is accelerating horizontally with an acceleration is Suppose that g = 9.81 m/s2, L = 1 m, and . Plot θ(t) for 0 ≤ t ≤ 10 s for the following three cases. 1. The acceleration is constant: a = 5 m/s2, and θ(t) = 0.5 rad. 2. The acceleration is constant: a = 5 m/s2, and θ(t) = 3 rad. 3. The acceleration is linear with time: a = 0.5t m/s2, and θ(t) = 3 rad. Submit your solution as Simulink *.mdl models include any required m-files Mathworks have changed the Simulink model file formats. This will present a problem for students who have Matlab versions prior to 2014. If you have a newer version of Simulink, please use the 'save as' feature to save your work as *.mdl and not as the default *.slx. This will allow students with older versions to run the models.