Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

THIS QUESTION HAS TO BE DONE PARTIALLY WITH MATLAB CODE PLEASE! Sweden and Norwa

ID: 2074270 • Letter: T

Question

THIS QUESTION HAS TO BE DONE PARTIALLY WITH MATLAB CODE PLEASE!

Sweden and Norway are at war over who makes the best pickled herring. You are in charge of a Swedish artillery unit that is trying to shoot at some Norwegians located 1000 meters away at the same height as you are. If we neglect the friction of the air, the cannon ball follows a parabolic trajectory; as you certainly recall from prior courses, the cannon ball travels the distance L = V 2 sin (2) g , where V is the initial velocity, is the angle of the cannon barrel, and g = 9.8 m/s is the gravitational acceleration. You realize that you only have two options for how to shoot. Option (I) is to use 1 bag of gun powder, which produces an initial velocity of exactly VI = 100 m/s, and to try to set the angle to I,nominal = 40 . Option (II) is to use 2 bags of gun powder, which produces exactly VII = 140 m/s, and to try to set the angle to II,nominal = 15 . (a) If you set the angles exactly to the nominal ones, which option is the best? Hint: This is trivial – just calculate the lengths LI and LII of each shot. The problem is that the cannon is old with a rusty mechanism – you can’t set the angle to exactly the value you want. You can model the actual angle as a random variable that is normally distributed around nominal with a standard deviation of 1 . Under this scenario, which option is the best? We can solve this problem in 2 ways: (b) First solve it with pen-and-paper, by using the approximate formulas for the mean and standard deviation of a nonlinear function of a random variable (the “error-propagation formula”). (c) Next solve it using numerical simulation. For each option (I and II), create N = 10000 random angles and compute the value of L for each random angle. Suitable Matlab code would look something like V = 100 ; alpha = pi/180*( 40 + 1*randn(10000,1) ) ; L = V^2 * sin(2*alpha) / 9.8 ; Now that you have N samples of L, you can plot them in a histogram, and also compute the sample mean and sample standard deviation. (d) Compare the answers from parts (b) and (c). Which approach (“error-propagation formula” or random sampling) do you think is the more accurate? What are the errors in each approach (explain in words)? (e) Compare the conclusions (i.e., which of options I or II is best) in parts (a) and (b-c). Is the answer clear in parts (b-c)?

Sweden and Norway are at war over who makes the best pickled herring. You are in charge of a Swedish artillery unit that is trying to shoot at some Norwegians located 1000 meters away at the same height as you are. If we neglect the friction of the air, the cannon ball follows a parabolic trajectory; as you certainly recall from prior courses, the cannon ball travels the distance 8. sin (2 where V is the initial velocity, is the angle of the cannon barrel, and g acceleration. 9.8 m/s is the gravitational You realize that you only have two options for how to shoot. Option (I) is to use 1 bag of gun powder, which produces an initial velocity of exactly Vi = 100 m/s, and to try to set the angle to 1,nominal-40°. Option (11) is to use 2 bags of gun powder, which produces exactly Vil 140 m/s. and to try to set the angle to aII,nominal1 (a) If you set the angles exactly to the nominal ones, which option is the best? Hint: This is trivial - just calculate the lengths Li and LII of each shot. The problem is that the cannon is old with a rusty mechanism-you can't set the angle to exactly the value you want. You can model the actual angle as a random variable that is normally distributed around ominal with a standard deviation of 1°. Under this scenario, which option is the best? We can solve this problem in 2 ways: (b) First solve it with pen-and-paper, by using the approximate formulas for the mean and standard deviation of a nonlinear function of a random variable (the "error-propagation formula") (c) Next solve it using numerical simulation. For each option (I and II), create N 10000 random angles and compute the value of L for each random angle. Suitable Matlab code would look something like

Explanation / Answer

I wrote the matlab code for part (c). I have plotted the mean and standard deaviataion on the graph itslef, rest of the conclusion is with your pen and paper calculations, that I think you have done as you have asked for matlab code only. So here is the code,

---------------------------------------------------------------------------

clc;clear all;
V=100;
alpha=pi/180*(40+1*randn(10000,1));
L=V^2*sin(2*alpha)/9.8;
histogram(L);
mn=mean(L);
md=median(L);
stdv=std(L);
% Create the labels

mnlabel=sprintf('Mean -- %3.2d', mn)
stdlabel=sprintf('Std Deviation -- %3.2d', stdv)

% show labels on graph
h=annotation('textbox',[0.3 0.75 0.1 0.1]);
set(h,'String',{mnlabel, stdlabel});