VB app to calculate velocity of a golf club head

AI Thread Summary
The discussion centers on developing a Visual Basic application to calculate the velocity of a golf club head based on user inputs like yardage, elevation, and club angle. The user aims to implement physics formulas to derive the necessary velocity for different club types, starting with a driver at a specific angle. Key points include the need for accurate mass values for the club and ball, as well as the application of conservation of momentum and energy principles to determine the ball's velocity post-impact. The user also seeks advice on adjusting calculations for varying swing power percentages and external factors like wind. Overall, the conversation highlights the complexity of accurately simulating golf club dynamics in a virtual environment.
jeffsweeps
Messages
3
Reaction score
0
Hi guys, i have read and read and read all this stuff about x=vt(cosA), y = vt(sinA)-1/2gt^2

now i am not a pyhsics guy and never claimed to be, i am a programmer. This is what i am trying to accomplish. I am trying to write a small VB app to calculate velocity of a golf club head. I and trying to evaulate it as follows:

CLub Head Angle is Diiferent for each club. but we are going to just pick 1, so let's say a driver with a 10.5 face

I have the following the only variable i wish to calculate is velocity.

I want to be able to type in a yardage (x) and an elevation (y) a club angle(10.5) and get the velocity.
am i on the right track here?
i got the formula from the hyperphsyics page.
My plan is since can get the max velocity of the driver by assuming the max distance for x at y=0 is 250 ... i could then use that velocity and set it equal to 100% (for 255 yds) and then calculate the velocity for 204 yds whish is (80% of club distance) and see what that velocity is.

I have been tasked with writing a program the will pick the correct "virtual club" given distance, elevation, and angle. Can this be done? I don't even know. I followed a tutorial along and calculated velocity for a target 300m away 20 meters high with a 60 degree angle, but i need a formula so i can plug it into my program and give it the x, y and angle and it give me a result, if that result is less than say 80% of the club velocity, then my program will automatically "club up" and recalculate using the next club angle ... ie if the 64 degree wedge shot can't get you there, then change to the 54 degree club and so on until the target distance is reachable. Since this is a "virtual golf simulator" i am assuming that 100% power on each club would be the same velocity.

Am i making any sense, sorry but i know some math, just not physics. Any help would be appreciated. thx
 
Physics news on Phys.org
This won't be a perfect model, but it will be close. Two things you are missing is the mass of the club and the ball. Hitting a ball made of lead will be different than hitting a regular golf ball. Hitting it with a club made of plastic will be different than using a regular club. You can measure the ball mass, but will probably have to mess around with club mass a little to get things to work reasonably.

You need to do two things. First find the velocity of the ball at just after the club hits it, then figure out how the ball will travel. For the first part the equations you need are conservation of momentum and conservation of energy. The things you know are:

mb = mass of ball
mc = mass of club
vx = horizontal velocity of club just before it hits the ball
vy = vertical velocity of club just before it hits the ball (probably zero)

a = the angle from vertical at which the club face hits the ball

You need to find

vcx = horizontal velocity of club just after it hits the ball
vcy = vertical velocity of club just after it hits the ball
vbx=vb*cos(a) = horizontal velocity of ball just after hit
vby=vb*sin(a) = vertical velocity of ball just after hit

So you have three unknowns, vcx, vcy, vb

Conservation of momentum says

mc*vx = mc*vcx + mb*vbx
mc*vy = mc*vcy + mb*vby

Conservation of Energy says

mc*(vx^2+vy^2)=mc*(vcx^2+vcy^2)+mb*(vbx^2+vby^2)

Thats three equations. Defining m=mb+mc and solving for vb gives:

vb =(2*mc*(vx*cos(a)+vy*sin(a))/m = 2*mc*vx*cos(a) if vy=0

So now you have to figure out how the ball travels given that it has velocity vbx and vby. Let x(t) be its x position at time t and y(t) be its y position at time t. Let's say x(0)=0 and y(0)=0. then

x(t) = vbx*t
y(t) = vby*t-g*t^2/2

where g is the acceleration due to gravity (9.8 meters per second squared or something). The ball hits the ground when y(t)=L where L is the elevation. It may hit L twice (once on the way up, again on the way down) so you have to be sure to pick the right one.

Solving the first equation for time, the equation for y(x) can be solved as

y=vby*x/vbx-g*x^2/vbx^2

Solving for x gives two values

x=(vbx*vby + vbx*sqrt(vby^2-4*g*y))/(2*g)
x=(vbx*vby - vbx*sqrt(vby^2-4*g*y))/(2*g)

I think the first one is the one you want. When you substitute L (the elevation) for y you will get the range x.
 
Thank you so much that really helped a lot and put me on the right path, i plugged them into excel before i started programming and i have a couple of questions. First, This is what i have so far. (if you got excel i attached it as a file also)
mb = 0.25 (Just plugged a number to test formulas for the time being)
mc = 1.5 (Just plugged a number to test formulas for the time being)

vx = 100 (Just plugged a number to test formulas for the time being)
vy = 0
a = 10
vcx = 100
vcy = 0

First Question HERE
vb =(2*mc*(vx*cos(a)+vy*sin(a))/m and? vb=2*mc*vx*cos(a)
or is that = {(2*mc*(vx*cos(a)+vy*sin(a))/m}/{2*mc*vx*cos(a)}
i assumed the first , i also swappped mb + mc for m

vb = (2*mc*(vx*cos(a)+vy*sin(a))/m = 168.8241862
vbx = 166.2593675
vby = 29.31601229
y = 10 (Given Elevation at target location)
x = (vbx*vby + vbx*SQRT(vby^2-4*g*y))/(2*g) = 432.0716961


For the Mass of club and ball, since they are "virtual" and i do not have them to get there actual mass. Could i take an flight path of a given club at 100% of it's velocity (Knowing distance, elevation, max height of arc,Club Angle) , i can view a balls flight path now after taking a shot. So i thought i could hit 100% power and get several different fligt paths to be able to calculate mb & mb ... Since i have and can graph each club at 100%, 98%, and so on and so on. Ccould i use the 100% swing power graph to get the mc & mb, Also the mb will remain constant for each shot. the onlt two things i have control over over club selection(club angle) and swing speed(club velocity)

geez u guys are smart, and i thought us cumputer nerds where real smart, i guess it is all knowing where to look , cause i can follow your calculations ... i just didin't know where in the world to find the formulas i needed , , geez i didn't een know which formulas i did need., i was originally trying to do this by club x max distance = 250 yds @ 100% power ... and scaling back from there but, THIS will be way more accurate as me model was flawed when elevation changed severely or when less than 85% swing power was used.
 

Attachments

jeffsweeps said:
First, This is what i have so far. (if you got excel i attached it as a file also)
mb = 0.25 (Just plugged a number to test formulas for the time being)
mc = 1.5 (Just plugged a number to test formulas for the time being)

vx = 100 (Just plugged a number to test formulas for the time being)
vy = 0
a = 10
vcx = 100
vcy = 0
You shouldn't set the velocity of the club after it hits (vcx and vcy). It can be calculated from vx, vy, mc, mb and a, but it is never used.
jeffsweeps said:
First Question HERE
vb =(2*mc*(vx*cos(a)+vy*sin(a))/m and? vb=2*mc*vx*cos(a)
or is that = {(2*mc*(vx*cos(a)+vy*sin(a))/m}/{2*mc*vx*cos(a)}
i assumed the first , i also swappped mb + mc for m
That vb line should have read:

vb = 2*mc*(vx*cos(a)+vy*sin(a))/m which equals 2*mc*vx*cos(a) if vy=0
jeffsweeps said:
vb = (2*mc*(vx*cos(a)+vy*sin(a))/m = 168.8241862
vbx = 166.2593675
vby = 29.31601229
y = 10 (Given Elevation at target location)
x = (vbx*vby + vbx*SQRT(vby^2-4*g*y))/(2*g) = 432.0716961
Just keep in mind there are 2 x's. I think the plus will always work, but if there is trouble, look at those two values of x.
jeffsweeps said:
For the Mass of club and ball, since they are "virtual" and i do not have them to get there actual mass. Could i take an flight path of a given club at 100% of it's velocity (Knowing distance, elevation, max height of arc,Club Angle) , i can view a balls flight path now after taking a shot. So i thought i could hit 100% power and get several different fligt paths to be able to calculate mb & mb ... Since i have and can graph each club at 100%, 98%, and so on and so on. Ccould i use the 100% swing power graph to get the mc & mb, Also the mb will remain constant for each shot. the onlt two things i have control over over club selection(club angle) and swing speed(club velocity)
I think that would work. Notice that mc is constant too, and for calculating vb you only need the one number mc/(mc+mb), not both mc and mb, so that might simplify things a bit.
 
OK i guess i am abandoning my efforts to solve for this, i do not think i have the capability to do so.

Although the formula worked out great to get that result, when i tried to translate club velocity into a % (as in 100% Power or 75% Power) of swing, my calcualtions were obviously wrong.

Take into account that i would also have to account for Wind Push/Pull and i think this may well be over my head.

Any ideas about how to change my thinking would help. I can "hit a ball" with 100% power with no wind and that is essentially the club velocity , when i start scaling back to a 75 or 80 % power shot , it just doesn't work. I do know that it is non linear, i just do not know how to translate % into club velocity, and since there are approximately 300 different clubs in this simulation .. that rules out getting exact velocities for each % of Power.

I do appreciate the responses, they have awakened me a bot to the world of math i left behind when i started programming.
 
jeffsweeps said:
Hi guys, i have read and read and read all this stuff about x=vt(cosA), y = vt(sinA)-1/2gt^2

now i am not a pyhsics guy and never claimed to be, i am a programmer. This is what i am trying to accomplish. I am trying to write a small VB app to calculate velocity of a golf club head. I and trying to evaulate it as follows:

CLub Head Angle is Diiferent for each club. but we are going to just pick 1, so let's say a driver with a 10.5 face

I have the following the only variable i wish to calculate is velocity.

I want to be able to type in a yardage (x) and an elevation (y) a club angle(10.5) and get the velocity.
am i on the right track here?
i got the formula from the hyperphsyics page.
My plan is since can get the max velocity of the driver by assuming the max distance for x at y=0 is 250 ... i could then use that velocity and set it equal to 100% (for 255 yds) and then calculate the velocity for 204 yds whish is (80% of club distance) and see what that velocity is.

I have been tasked with writing a program the will pick the correct "virtual club" given distance, elevation, and angle. Can this be done? I don't even know. I followed a tutorial along and calculated velocity for a target 300m away 20 meters high with a 60 degree angle, but i need a formula so i can plug it into my program and give it the x, y and angle and it give me a result, if that result is less than say 80% of the club velocity, then my program will automatically "club up" and recalculate using the next club angle ... ie if the 64 degree wedge shot can't get you there, then change to the 54 degree club and so on until the target distance is reachable. Since this is a "virtual golf simulator" i am assuming that 100% power on each club would be the same velocity.

Am i making any sense, sorry but i know some math, just not physics. Any help would be appreciated. thx

This might be considered cheating but you should be able to aim a radar gun at it and then work your math backwards. What you need is a given to anchor your math with and basically you do not have any given to anchor your math with. Once you have a given (velocity) from there it is just a matter of testing different environmental conditions until you have a relatively stable mathematical formula that your average golfer can use.
 
Hello everyone, Consider the problem in which a car is told to travel at 30 km/h for L kilometers and then at 60 km/h for another L kilometers. Next, you are asked to determine the average speed. My question is: although we know that the average speed in this case is the harmonic mean of the two speeds, is it also possible to state that the average speed over this 2L-kilometer stretch can be obtained as a weighted average of the two speeds? Best regards, DaTario
The rope is tied into the person (the load of 200 pounds) and the rope goes up from the person to a fixed pulley and back down to his hands. He hauls the rope to suspend himself in the air. What is the mechanical advantage of the system? The person will indeed only have to lift half of his body weight (roughly 100 pounds) because he now lessened the load by that same amount. This APPEARS to be a 2:1 because he can hold himself with half the force, but my question is: is that mechanical...
Some physics textbook writer told me that Newton's first law applies only on bodies that feel no interactions at all. He said that if a body is on rest or moves in constant velocity, there is no external force acting on it. But I have heard another form of the law that says the net force acting on a body must be zero. This means there is interactions involved after all. So which one is correct?
Back
Top