Transcript for:
Understanding Projectile Motion and MATLAB

okay so in the previous class we started projectile motion and we solved the problem from book projectile motion right and we governed equations Today I'm going to solve other problems from book. Ummm... Okay... Ummm... Problem... problem 283 as i promised you so a projectile This is launch from point A to C with initial velocity of 120 m per second. And the angle of shooting is 40 degree with the initial condition shown in the figure. Determine the slant distance S. See here this. This S. Which locates the point B of impact. Calculate the time of flight. Same time. So it gives us this angle degree 20 and this 800 m. So we're going to calculate S and what? S and time of flight. So problem 283. And let's plot this here for you. And the angle of it. So we're going to shoot, we're going to launch it from here. This is point A and this is point B. And here is. 120 meter per second and the angle of shooting is 40 degree here is 800 meter this angle is 20 degree so we're gonna calculate this you got it so we want to calculate so we want to calculate s this length and the time of flight so I taught you in time independent equation y was minus g x squared that we derived in the previous class and you have it in notes to initial velocity squared cosine of angle of shooting squared plus x tangent of theta plus y You're having a notes. So what's the first system in dynamics? I told you a million times. What's the first system in dynamics? Wisely and smartly select coordinate system. Respect to the problem nature. So we're going to put coordinate system in the Cartesian x and y. Why? Because by doing that, you're going to say bye-bye to y-nest. There is no initial height, right? It's that zero. So your X is the travel distance by this same style. So this is total X that you're going to have. Because here, point B, this is the total X that you're going to have. See, this is the total X. Right? And here is 90 degree for God's sake from kindergarten. Right? So, see this triangle. So you know that the x is 800 plus this value. This value from this triangle is s. Cosine 20 degree. So we're going to be plus S cosine 20 degree. There we go. What's the Y of that? We got the X. What's the Y? Y is this obviously. This is Y from the coordinate system. So your Y from this triangle is S sine. 20 degree yes everybody simple you're just going to implement there so your y is s sine 20 degree equals to minus gravity in our planet 9.81 meter per second square your x is 800 plus s cosine 20 squared divided by 2 multiplied by V naught 120 second square multiplied by cosine of shooting 40 degree 40 degree this is squared shooting that is 20 right we got it ma'am plus again your x is 800 plus S cosine and this totally is the square. All of this. Okay. Cosine 20 degree in tangent of which angle? Shooting 40 degree. Here we go. So how to solve it? One of the solutions go to your calculator give us an equation but eventually when you come to other classes as a mechanical engineering after graduation as engineers you have to know how to work with the coding softwares like MATLAB like Python right now I'm teaching vibration for ME520 or next semester I'm teaching control ME520 530 or robotic class in 532 when you go to grad school you have to expert of the matlab or python okay that's why now i'm shifting the problem and taking it to the matlab matlab you have access to a student version of that yeah sure go ahead So when I was undergrad student in my country Iran in my sophomore 1999 Yeah I look young but I was sophomore in 1999 1990 young? Okay, so I had, we had a professor, he was graduated from Imperial College London, and he was teaching us American analysis, and he was telling us on that time MATLAB was very trivial version, that if you graduate and you don't know how to code in MATLAB, work with MATLAB, you are not engineer, you are whatever, but not engineer. How many years ago? 25 years ago. We didn't perceive what he's talking about but when I went to grad school and came to US as a PhD student Oh, now these days MATLAB is good, but very powerful in coding and graphically But eventually when you go to school you have when you work with robotics You want to do the real experiment? You have to also learn Python, but MATLAB helps you to make a structure of coding mind okay and see this is let me show you to see that I was teaching exactly before this class to the vibration class of mine and I'm sharing the code with you can you believe that this is the model of your hand and or leg when you dance I was teaching in the vibration and I did a code for that by differential equation that you're gonna pass eventually I just want to show as a as a as a fun Whatever you learn in this class is going to be basis for vibration and control. See, by coding I did this to students. You see your hand or leg when you dance. Okay, we name it moving pendulum. That as I told you the mission of this course that teach you to drive the collision of the motion to come to this point. In ME520, ME530. when you go to grad school when you go to industry okay that's why dynamics is super important okay so i don't want to discuss this with you because you're going to escape from mechanical engineering okay so um but okay this is uh m file in math lab if you had me202 hopefully if not this is how we generate m file going to new so i'm going to solve this equation So this equation has a parameter unknown parameter less s I'm saying x because we know that so you know that we're gonna define a symbolic Sims x when I see Sims means make it symbolic Okay Sims make symbolic so x becomes pink means not the symbolic variable Symbolic then I'm gonna say okay I want to solve this equation So I'm gonna say a because you see we have a repeating term here 800x cos 20 800x cos 20 right So I'm gonna define you have to learn how to optimize you have to compact your code Okay this is very super trivial code we are writing we're gonna be 800 plus x cos 20 but never write in code the numbers of 20 because you have to change it to radian always encoding always never write angle like calculator okay so line above come down you say angle of slant I'm just defining a parameter is 20 in pi multiplied by 180 now change it to what to to radian yeah but sometimes you can do that okay okay so i'm just teaching you very very basic things okay to emphasize to change it to i can use the costi okay but i want to emphasize change it okay so angle of the slant okay Angle of slant I want to teach you how to replace parameter inside your code See what I'm saying so this is parameter A so and then I'm going to save it Ctrl S in ME 220 file 224 I'm gonna say projectile I'm going to share with you after the class by YouTube link and sending them file solution I just see the name appears here let me close this because I don't want to do it okay and always in your MATLAB code not now what I'm teaching you always use clc command at the top of the code what does it does clc yeah clears the your command window see here I'm putting clc everything goes and then use always clear all commands okay means for the next run it clears the cache or memory of the MATLAB and it doesn't confuse the code always do it as a professional coding writer and always write close all close all okay if you have graphs for the next run close automatically you don't have to close a lot of them okay everyone if you have figures so now let's go to our problems the s uh s uh 20 so okay when you do that you're gonna say okay say is your uh s is solve okay solve now you have to move this this is commanding math lab you have to move this to the other side this to the other side and make it to zero One side. pull off this other side so minus so i have a constant number here i'm not stupid to type it everyone everywhere i'm gonna say okay i'm gonna define here i'm gonna say b is minus uh 9.81 divided by bracket right how much is that 220 cosine so uh two multi by 120 squared multiplied by what cosine of which angle 40 right so for teaching purposes I'm going angle of shooting is 40 for teaching purpose so I never do that okay 180 to emphasize I have to change it to radian okay angle of angle of shooting and all of this squared. Here we go. You got it? What is this 2? Oh, this 2 is for this. Okay? And this is square and this is square. So we did B. Just define B. So solve this B multiplied by A multiplied by A. by a squared we just defined a squared that this is a that's right 800 cosine this see what I'm doing yeah plus plus what plus s as a minus s sine 20 so minus your u.s. is X that's right because our value was X What is that? X. See? X multiplied by sine 20. Sine 20 is angle of slant. That's right. Angle of slant. Okay. Plus again, A in tangent of 40. Plus A multiplied by tangent of 40. Angle of shooting. Here we go. Here we go. Okay. Control s I save it. We got it everyone this is gonna give you s just let us debug our code Change the folder because it's from previous class. Oh There's a tie over here. My keyboard is screwed up What is Where is that? Angle of Slant angle of shift. Oh, this is 40. That's right. SH. Right? Let me double check everything. I'm a human being. Cosine 20 minus this square cosine SH 40. B. a square minus x sine slant plus a in tangent of slant. Okay, that's right. So, it gives you two roots, guys. But the problem is that you cannot read it. Huh? It's pretty easy. Just put i, if I remember. just put this command double double solve okay double solve or eval let me see which of them works here we go we got it so you have two solutions one of them is point obviously negative one is stupid one because we don't have negative distance try it for s So this is 0.457 multiplied by 10 to the power of 3 Means 454 or 55 meters You got it Change those huge terms by double to here See what I'm saying everybody Clear I'm going to share with you That's it I'm going to close it now So we got the solution Sorry guys. So we got the solution from MATLAB that the S slant is almost 455 meters by using MATLAB. I'm going to share with you after. class by using matlab okay but i taught you that for the projectile we have this x is equal to v naught cosine of shooting in t plus x naught how many oh this is cosine multiplied by t Plus X naught. But as you selected our coordinate system here, X naught is 0. So you get time of flight is X divided by V naught cosine of theta. Your X is totally this. This is your X. Just put the slant there. So it's going to be 800 plus 400. 55 cosine 20 degree divided by 120 multiplied by cosine 40. You got it? Yes? You can continue the code in MATLAB. You just double it and simply calculate this. So time of flight, I have numbers. Can I go to the next page? Time of flight is 13.55 seconds. Here we go. Okay, so just hinting to other problems and we are done. Like this basketball player, see the basketball player likes to release his fall shoots with the initial speed of 23.5 feet. So it does this and that. What values of the initial angle now? This is unknown. Will cause the ball to pass through the center of the rim. Okay. NBA players, they do it by practicing, but it has a formula. Okay. Negative clearance consideration as the ball passes through. Okay. So the height of the, say, LeBron James is 7 feet. So the clever thing is that you set up your coordinate system here. By doing that, what is your y0? 0, right? Obviously, your x0 is also 0. So your final y is going to be how much? 10 minus 7 feet, 3. so your y that you're gonna put in is 3 feet your x that's gonna travel is how much 13 feet and 9 inch first be careful okay you have to change it everything to fit or fit or inch that's right yeah so now put in the time independent and solve for it you can use MATLAB and solve for theta for the angle of shooting you got it everybody and the rest are the same so let's go to next topic i promised you the first one the cartesian coordinate system we covered all the problems now let's go to next one normal tangential coordinate system Normal tangential coordinate system. In Cartesian coordinate system, the unit vectors was I, J, K based on the right hand rule as I taught you. Okay, normal tangential coordinate system. is when you are in the car on the curve on the ramp toward what? Toward SDSU from I8. Suppose this is your car from point A as a particle. And then going to the point A prime. And it's center of the rotation of your car over the ramp. And here is point C center of the rotation. and this radius of rotation of the core is say is Rho, it's in notation Rho even in math lab when you want to go to upper level divisions when you're coding we write the Greek letter Rho in math lab okay you got it so when you on the curve guys you feel a kind of what at section from the center of rotation is right and it go like this so we're going to set up our coordinate system like this see en this is the unit vectors in the normal tangential coordinate system en normal to trajectory and tangential to trajectory et tangential so this angle is 90 degree normal to trajectory and tangential trajectory angle and you fill it every day coming to the CSU from I8. Obviously velocity of your car is what? It's tangential to the trajectory so this is the V, V of your car, V of your car is in direction of the ET velocity. This is happening okay and let us say this angle This angle that when you travel from point A to A prime is a small db, a small angle of beta, beta, beta. Like the case of Cartesian coordinate system that the magnitude of the unit vectors was 1. The same is here. Magnet of the E and unit vectors of normal tangential, they are one also. Right. So when you draw your car or this curve, you are traveling on this is S. Right. S is DS, right? Real trajectory you're traveling, DS, right? Or S. Let me write this S. But we taught you very basically that velocity is change of displacement over change of time. If you go back to high school, you know this arc, this arc of A, A prime is how much? Rho D beta. Remember? Everyone? Let me remove this D. And for now, because I want to make a point. This angle bit, row bit, this arc length is row radius in angle. This arc. So I'm going to just put it here. So, oh sorry. It calls to S from A to A prime. Right? Right everyone? I'm going to put it here. So you're going to have. d over dt your s is Rho Beta I assuming the normal tangential coordinate system this radius is constant constant value say 2 meters look at the ramp of SDSU from I8 but this comes out in differentiation you're gonna have d Beta over dt. But all of you don't write. Look at me. Look at the board. Velocity is what? Velocity is what? You name it. Vector. And I showed you. And it happened in your car. I showed the velocity of your car in the direction of which unit vector? Et. Tangential to the trajectory. That's right. So you have to say in the direction of Et. We have to write it down. Right everyone? Tangential coordinate. So you know this definition of the derivative, time derivative from high school. So you're going to have a Rho Beta dot Et. So we found it. Any moving object or particle on the normal tangential coordinate system that you select properly for your system is radius in angular velocity. Rho is radius, beta dot is angular velocity. Right. Later we go in the next chapter 5 or 6 for rigid body. We learn that this is the same. V is angular velocity cross product of radius. This is cross product, you know how it works right? Okay, I'm gonna do that now. Guys! So, I'm going from A to A prime. Right hand blue always. Thumb shows out of the page, forefinger shows the direction of rotation. Right? Yes? So your omega, angular velocity, beta dot or omega, its direction is outside of the page. Forever. Angular velocity follows right hand zone, forefinger shows the direction of rotation. Thumb shows direction of angular velocity. That's the rule. Understand? Write it down. Right hand rule to determine the direction of angular velocity. Four fingers shows the direction of rotation. Thumb shows direction of time. Being said, so being said, you're... angular velocity for this problem. Let me look at here. It's how much? It's beta dot k. That's right, k. All side of the page. See what I'm saying? Okay? Ta-da! In K. So, in K, outside of the page. This K. So, the sequence of this, Olaf, you look at here. Don't try. For Cartesian coordinate system, what was sequence? IJK. Right hand rule. It is going to be ET. E and K. If you rotate four fingers from E to E and thumb shows K. From E and to K shows E to from K to E to shows E and. So the sequence is E T E and K. So the sequence for this is E T E and K. You got it everybody? Just playing with your fingers, this is not even dynamics. Okay, ET, ENK. Let me show you sir. K is alpha of K, that's right? There we go. This is K alpha. ET, rotating ET to EN shows K. EN to this shows ET, K to ET shows E. That's right? Right now. Everywhere is right hand rule for dynamics. Even you go to any 532 robotics with me or Dr. Ahmet Davadi. These are basics for robotics. Okay? Understand? Everybody? So, being said, I told you you can determine the direction of the angular velocity by right hand rule. Now we know the case outside of the page. Right hand rule. shows this direction out Omega is that why I'm going to do that because I'm going to show this is valid I'm going to make your wide very your region very wide not for dynamics for after graduation okay so what is your r what is your r here based on coordinate system your r Rho what? This is your R guys. This is your R. See? This is your R. Rho. Rho what? Plus or minus? Because En is inside but your R is outside. It's minus Rho En. See what I'm saying? Yes? So do you know what's a cross product? For God's sake? So if you have it, so cross product of, so velocity is, I said is beta dot k multiplied by minus rho en. That's right. We just did it. Omega r. You know that this is. being determined by determinant right what was the sequence e t e n and k this is how we write this right because sequence matters i thought i taught you this right so your omega is this zero zero beta dot because that's k component right everybody your row your r is this 0 minus rho 0 because it has en compound. Right? Yes. So this is going to be this from high school. 0 beta dot minus rho 0 plus. Sorry, minus. Minus EN0 beta dot 00 plus K000 minus rho. Obviously, these are zeros. Answer is rho beta dot ET. Bingo! The same that we derived here. we derived by vision but it's mathematics is this even when we go to rigid body dynamics now we are in the particle okay so again right hand rule for sequence of unit vectors right hand rule to determine the direction of angular velocity and angular acceleration later for rigid body okay Dynamics is very simple. You can understand it basically. Okay, so and obviously beta dot that you know is unit is radian per second in SI system radian per second. Okay. No. I want to calculate acceleration over here. I want to calculate acceleration. So the acceleration is dv over dt. Basics. d over dt. So your v is rho beta dot et. We just derived together. I'm just putting here. And I'm going to change the color of et. I have lots of things to do here. Why I'm changing this? This 18. Let's go back to high school. What is time derivative of rho? A constant number. How much is that? What is time derivative of 2 meters? Constant. Zero. So, we don't have such things. What is time derivative of beta dot? Beta double dot. Angular acceleration. So it's going to be rho beta double dot et plus rho beta dot et dot. Oops! It says the unit's vector has time derivative. It has indeed. It has. Why? I will show you. Guys, what is a vector? I told you. What is a vector? It has two properties. One of them is? Magnet. Magnet is one. There is no tangent from one to zero. When your car on the ramp from Y8 to SDSU goes from A to A prime. Sorry. Oh, sorry. So when you come to here, again, this is your EN. This is ET, right? And I'm going to say EN prime, ET prime. Show the change. Guys, when your car comes from A to F1, look at here, I love you. This is EP, but after a while, EP is in this direction. So direction of EP changing. Direction of EP changing. So it has time limited. Because time limited means changing the time. Okay? Now I have a time limited because I am moving. okay even my face has a time limit because when i was a child i had an older face here we go my bones they have time to do because grown until until until when i was 18 years old like that which means running until but after that it's fixed right see what i'm saying so time derivative is for everything so it's being said We have to calculate this because this is angular acceleration by definition. Angular acceleration and its unit is radian per second squared. Obviously you got it. Yes. so how to calculate that now let's go for it okay guys i said this is et but after a while et becomes this e prime t but magnitude is the same didn't change right huh guys from high school if you want to this is change of et that's right this is delta e t delta e t right okay so if that is that that's better show you where is it? if this is β, also this angle gonna be β right? because changing with β everything is right so here gonna be also β right? so Δet gonna be from this small triangle gonna be Mg That's right. In beta. In which direction guys? In which direction? Look at here. Look at the graph. In which direction? EN. That's right. Look at here. If I plot this here, these are the same. That's right. In direction of the EN. Right? So you're going to say in direction of EN. So have both divided by delta t. Change in times, right? And what's the value of this? For God's sake, I told you. Unit vector 1. So it's going to be, and let me take delta beta. The small value of angle. Delta beta over delta t in en. And having a limit of. both sides delta ET over delta T calls to limit of delta beta over delta T in direction of EM and delta T goes to 0 delta T goes to 0 what's the definition of this you tell me E dot T here we go we just find it That's right. Derivative of the neutrality. This is beta dot en. We just found it. Time derivative of et is angular velocity in direction of en. Angular velocity in direction of en. You got it? Huh? So, being said acceleration in normal tangential coordinate system. what is that is Rho beta double dot Rho beta double dot Et plus Rho beta dot beta dot En so plus Rho beta dot square En right or another form because we derived velocity is Rho Beta Dot. If I square Velocity Square, it's going to be Rho Square Beta Dot Square. If I divide both sides by Rho, it's going to be Rho Beta Dot Square. Here we go. Another form of writing in the books are this Rho Beta Double Dot Et Plus V Square over Rho E-M and that's the acceleration. It depends on if beta, typically they're going to, we're going to see in the book, we're going to see that in the playground. a device is rotating with the constant angular velocity of 2 radian per second 2 radian per second so when you take the derivative of that so derivative of that beta double dot is going to be zero but if say it's changing with time so you have to have time with it to calculate for beta double dot yeah yes we're gonna see what we're gonna i'm gonna solve many problems okay so now having that see that um we we saw that velocity in the direction of let me plot it here you guys you also plot We saw that the velocity in the direction of ET, that's right, this is ET, this is EN. And you see the acceleration has two components. One of them is in direction of ET, AT. Another is in direction of AN. The resultant vector is going to be in this direction, total A. and that's why when you're on the on the well that's why you're on the tell me on the i forget the name ramp and you go on the up you feel that you want to go inside the ramp because of this this a goes kind of inside the ramp this is what why you feel it right so being said You know from high school that the absolute value of the final a is going to be at squared plus an squared. So we're going to be rho beta double dot squared plus rho beta dot squared. So if you factor out rho and take it out, so you're going to be rho beta double dot square plus beta dot power of 4. Now I want to make a point guys. We got by that triangle. I told you when the direction of the unit vector changes. You have time to do two of them. Please go at homework for yourself before I teach you a general concept. These are specific concepts. Next class. Based on the technique I taught you, find en dot. Why? Because you see, also en is here this year but after a while it's here. direction of that change right based on the that triangle i plotted you can't find it okay then next class i'm going to teach you how to generally not for this problem with this unit vectors directly can be calculated by formula okay i'm not going to solve problems for the normal cognition you got it