Question
In MATLAB write a program that given the parameters from problem 13.171 (pg 900) that calculates the horizontal and vertical position of the ball after it strikes point A and until it lands at point B. Use a time increment in seconds that results in a smooth curve. Fully document your script file including a problem description and fully label your graph.

from vector mechanics for engineers eleventh edition (Beer, Johnston...) chapter 13 problem number 171

8:24 PM Vector Mechanics for Engineers Chapter 13 Problem 171P iPad 41% . v Expand all steps Step 1 Draw the schematic of the trajectory of the ball. 3 ft 60 Step 2 Step 3 0 Step 4 Step 5 Step 6 0 Step 7 0 Step 8 Step 9 Step 10 0
0 0
Add a comment Improve this question Transcribed image text
Answer #1

STEPS TO RUN THE CODE

-COPY THE CODE

-OPEN MATLAB AND THEN CREATE NEW SCRIPT

-PASTE THIS CODE THERE AND CHECK FOR FORMATTING ERRORS AND RUN IT

-A GRAPH WILL BE DISPLAYED SHOWING THE REQUIRED DIAGRAM

- X AND Y VALUES FOR DIFFERENT TIMES WILL BE DISPLAYED IN COMMAND WINDOW(NOT REQ FOR SOLUTION, GIVEN FOR UNDERSTANDING)

CODE

%%%%%%%%%%%%%%SECTION 1-INITIALIZATION OF VALUES%%%%%%%%%%%%%%%%%%%%%%%

syms xnew ynew
colorstring='kgbry'; %TO GIVE COLOUR
H=3; %initial height ,inft
alpha=60; %Angle OF WALL INCLINATION in DEGREES

g=32.174; %gravitational acceleration in ft/s^2
vo=25;
e=0.9;
dt=0.01;
t=0;

%SECTION2-CALCULATION OF INITIAL VELOCITIES AND POSITION OF THE PROJECTILE%

vt=vo*(sind(90-alpha));
vn=vo*e*(cosd(90-alpha));

vxo=vn*(cosd(90-alpha))-vt*(sind(90-alpha));
vyo=vn*(sind(90-alpha))+vt*(cosd(90-alpha));

x=H/tand(alpha);
X=H/tand(alpha);
y=H;
Y=H;

%%%%%%%%%%%%%%%SECTION 3-PLOTTING THE WALL AND THE FLOOR%%%%%%%%%%%%%%%


A=0;
B=0;
Anew=A+(H+2)/tand(alpha);
Bnew=B+H+2;
plot ( [A Anew] , [B Bnew],'-r','Color', colorstring(1)); hold on
xlabel('X distance');
ylabel('Y distance');
title('Path of the ball');


A=-15;
B=0;
Anew=0;
Bnew=0;
plot ( [A Anew] , [B Bnew],'-r','Color', colorstring(2)); hold on


%%%%%%%%%%%%SECTION 4-PLOTTING THE PATH OF THE BALL%%%%%%%%%%%%%%%%%


while (y>0) %calculate until trajectory goes out of
%bounds
t=t+dt; %incremcwent time
xnew=X-vxo*t; %compute new x-position
ynew=Y+vyo*t-0.5*g*(t^2); %compute new y-position


%to display values of x and y for various time(not required for the
%solution)

V=fprintf('At time t= %d x= %d y=%d',t,xnew,ynew);
disp(V)

%plot latest segment of trajectory:
plot ( [x xnew] , [y ynew],'-r','Color', colorstring(3)); hold on

x=xnew;
y=ynew; %update values of x and y
end
legend('wall','floor', 'path of the ball');
hold off

Output graph:

Path of the ball 10 wall loor -path of the ball 4 16 14 12 10 -8 -6 4. X distance

Add a comment
Know the answer?
Add Answer to:
In MATLAB write a program that given the parameters from problem 13.171 (pg 900) that calculates...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • this is in reply to the answer I was given for chapter 4 problem 137. Thank...

    this is in reply to the answer I was given for chapter 4 problem 137. Thank you so much for the very complete answer that you sent down and I just have one remaining question why are they position vectors inverted. I mean if point P is the origin and then say you direct that position vector down to see where it touches the line of force of C then is the position vector inverted as if it's coming from...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT