Write a Matlab program (function) that can be used to model a throwing motion.
16 views (last 30 days)
Show older comments
Task:
''The program is given the mass of the ball to be thrown, the throwing angle and the direction of the angle initial velocity. Mass = 7,26 kg distance for the throw = 20 m.''
This is where it gets tricky for me (task continues):
''The program must give the result of the range value of the throwing movement and the kinetic energy of the ball at the time of departure or drop. Air resistance does not need to be taken into account in calculations. The program must also draw a graph of the trajectory of the ball.''
I can make two separate graphs for its KE and throwing angle, but I can't solve the task at hand.
If anybody can help me to solve this, thank you a lot for your time in advance.
0 Comments
Answers (1)
Amit Dhakite
on 11 Apr 2023
Edited: Amit Dhakite
on 11 Apr 2023
Hi Sasu,
As per my understanding, you want to calculate the Kinetic Energy of the ball at the time of departure and also want to draw a graph showing the trajectory of the ball.
To calculate the Kinetic Energy of the ball, you can use the formula:
% Kinetic energy
KE = (1/2)*m*v^2;
% m = mass of the ball
% v = velocity of the ball at the time of departure
On the second part of the question on the graphical analysis, you may refer to the following MATLAB answer, which addresses a similar query:
2 Comments
Amit Dhakite
on 11 Apr 2023
I assume you are talking about the normal functions used in programming languages. In order to use function you can simply transfer the whole implementation inside a body of the function.
m = 7.26;
v0 = 10;
% OR take input from the user: input('Enter initial velocity of the shot put here: ');
angle = (45);
g = 9.81;
Kinetic_Energy = my_fun(m, v0, angle, g);
function KE = my_fun(m, v0, angle, g)
hold on
for angle = 45
tges=(2*v0.*sin(angle.*(pi/180)))/g;
t =linspace(0,tges);
vx = v0.*cos(angle.*(pi/180));
vy = v0.*sin(angle.*(pi/180));
sx = vx.*t;
sy = vy.*t-0.5*g.*t.^2;
KE = 0.5*m*(v0.^2);
disp('Kinetic energy is:')
disp(KE)
plot(sx,sy);
end
hold off
end
To know more about the function, please refer to the following link:
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!