It\'s Christmas Eve and Santa Claus has taken off from North Pole with his sleig
ID: 3878713 • Letter: I
Question
It's Christmas Eve and Santa Claus has taken off from North Pole with his sleigh full of presents to distribute them to the all the kids around the globe. Unfortunately, the Grinch, who hates holidays and wants to destroy and steal Christmas, has set a mean plan to take Santa down. He is using a cannon, which is placed in Iceland and is targeted towards Santa's sleigh. He wants to shoot the sleigh and bring down all the presents for himself! Assume you are the Grinch. Listening to the news, you heard that Santa's sleigh was reported to be at the following coordinates during his journey: X coordinate Y coordinate 10.80 16.16599 19.40 25.4055 23.00 28.31672 27.80 31.32027 38.90 34.42243 39.50 34.43723 41.05 34.4029 42.00 34.33013 Table 1. Santa's sleigh x and y coordinates Develop a MATLAB program to calculate the trajectory of both the Santa Claus and the cannon ball and make sure that the cannon ball hits Santa and releases all the presents. In order to calculate the sleigh's trajectory you will need to use the coordinates given in Table 1 and use a curve-fitting algorithm to extract the trajectory's equation. Your program should have all the necessary values for the initial velocity of both objects (Santa's sleigh and cannon ball), the launch angle from horizontal line and the gravitational acceleration. In order the cannon ball to hit the sleigh, you will need to calculate the intersection point of the two trajectories. After the calculation, an animation of the trajectories should be produced, by modelling all the objects involved (i.e. the sleigh, the ball etc.). Finally, after the collision of the two objects, you need to re-calculate the new direction of the sleigh's velocity (assume that its value remains constant and the same as the initial velocity, for simplicity) and determine the point where the sleigh will hit the ground. Do not forget to add appropriate comments to your code and use reasonable names for your variables. Notes: 1. The velocities of the objects are constant. 2. The air resistance is negligible. 3. The alteration of the gravitational acceleration is not taken into account. 4. The mass of the sleigh and the cannon ball are respectively: msteign = 200 kg, mball = 15 kg 5. The (0,0) point is located on the cannon, as shown in Figure 2.Explanation / Answer
Answer: See the code below:
-------------------------------------------
%Coordinates of sleigh
x = [10.80 19.40 23.00 27.80 38.90 39.50 41.05 42.00];
y = [16.16599 25.4055 28.31672 31.32027 34.42243 34.43723 34.4029 34.33013];
%mass of sleigh
m_sleigh = 200; %in kg
%mass of canon ball
m_ball = 15; %in kg
%equation of trajectory of sleigh
order = 2;
p = polyfit(x,y,order);
%gravitational acceleration
g = 9.81; %in m/s^2
%initial velocities
u_sleigh = 10; %in m/s
u_ball = 20; %in m/s
%launch angle of canon ball
theta = 30 %in degrees %change this value to find at which angle canon will hit sleigh.
%time vector
t = linspace(0,1,10);
%trajectory of sleigh
x_sleigh = u_sleigh.*t; %distance covered by sleigh
y_sleigh = polyval(p,x_sleigh);
%horizontal displacement attained by canon ball
x_ball = u_ball.*t.*cos(theta*pi/180);
%vertical displacement of canon ball
y_ball = u_ball.*t.*sin(theta*pi/180)-(1/2).*(t.^2);
%plot trajectories of both
figure;
plot(x_sleigh,y_sleigh,'-bo',x_ball,y_ball,'-r*');
legend("Sleigh","Canon Ball");
---------------------------------------
Note: This program calculates the trajectories of sleigh and canon and plot them assuming certain values of initial velocities and launch angle. You can experiment with these value to find out how canon ball will hit sleigh.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.