Why does 2-angle between vectors give different components then individual angles?
Show older comments
My problem is with 3d vectors but the problem is the same in 2-d and a bit easier to explain so I will in 2-d.
I am modeling oblique impacts and I have Vx and Vy acting at an angle theta.
To get the components of velocity acting along theta it is:
Xcomponent = Vx*cos(theta)
Ycomponent = Vy*cos(90-theta)
Now I try and do the same problem but with Vx and Vy as a vector and then try to get the components acting along vector with angle theta and get a different result. How do I use vectors to get the same result?
This is what I did. Found the angle between the two vectors.
Angle_between = acos(dot(vector_along_theta,Vx_VY_vector))
Xcomponent = Vx*cos(Angle_between)
Ycomponent = Vy*cos(Angle_between)
Can not give the same result cause for the Y component the first way uses theta the second 90-thea.
Plus the resultant angle between them is not the same as theta anyway.
Help would be greatly appreciated!!! I got a C+ in physics back in the day, probably why I can't figure this out.
7 Comments
Geoff Hayes
on 2 Nov 2014
Cody - I'm guessing that the above is just an example so that when you really do
cos(90-theta)
you either convert 90 degrees to radians, or use cosd instead (are the units for theta radians or degrees?). For simplicity, you could replace this with the sine equivalent since
cos(90-theta) = cos(90)*cos(theta) + sin(90)*sin(theta)
= 0*cos(theta) + 1*sin(theta)
= sin(theta)
So your x and y components become
Xcomponent = Vx*cos(theta);
Ycomponent = Vy*sin(theta);
The above assumes that theta is in radians.
Geoff Hayes
on 3 Nov 2014
Cody - what is n1, v1, n1u, and v1u? Please write out all code from start to finish, with all local variables assigned. As well, it isn't clear what (for example)
n1u(j,[1 2 3])
is supposed to return. Is n1u a function?
Cody
on 3 Nov 2014
Geoff Hayes
on 4 Nov 2014
Can you attach your code so that I (or someone else) can run through it?
Answers (0)
Categories
Find more on Performance and Memory in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!