|
-
Mar 16th, 2006, 03:21 AM
#1
Thread Starter
Frenzied Member
[Resolved] Trigonometry and Vectors
Having a dumb moment, so I need a little help. I have a 'vector' defined as U=-4.3, and V=-3.3
From these two figures I need to derive an angle of about 45degs and a speed of about 11.
I have no idea (although remember doing stuff like this ages ago) where to start. Actually that's not true . . .
The hypo = -5.42 (by way of pythag) I can get the tan of the angle (o over a) but I can't recall how to derive the angle - and I certainly have no idea how to derive speed . . .
I presume that the speed is the length of the vector?
Last edited by yrwyddfa; Mar 16th, 2006 at 06:18 AM.
"As far as the laws of mathematics refer to reality, they are not certain; and as far as they are certain, they do not refer to reality." - Albert Einstein
It's turtles! And it's all the way down
-
Mar 16th, 2006, 03:46 AM
#2
Re: Trigonometry and Vectors
Explain 'U' and 'V' to me. I think I probably know the rest.
-
Mar 16th, 2006, 03:47 AM
#3
Thread Starter
Frenzied Member
Re: Trigonometry and Vectors
From what I can gather they are the opp, and adj respectively - but I'm not sure . . .
"As far as the laws of mathematics refer to reality, they are not certain; and as far as they are certain, they do not refer to reality." - Albert Einstein
It's turtles! And it's all the way down
-
Mar 16th, 2006, 03:49 AM
#4
Re: Trigonometry and Vectors
My memory of this is a little faded 
What does the overall vector represent? Velocity?
-
Mar 16th, 2006, 03:57 AM
#5
Thread Starter
Frenzied Member
Re: Trigonometry and Vectors
The values are an ouput from the a numerical weather model. They denote wind speed and direction; Supposedly using simple maths it can be converted into which direction the wind is coming from and how fast it is. The results I quoted are from an interpretation of that model from elsewhere, so for instance given the values U=-4.3, and V=-3.3 I should be able to derive that the wind will be N'Ely of about 11 (not sure of units) [edit]it's in mph, but the output might be in knots, so that might have to be converted, too[/edit]
My memory is gone, too - it's been sixteen years since I last looked at trigonometry
"As far as the laws of mathematics refer to reality, they are not certain; and as far as they are certain, they do not refer to reality." - Albert Einstein
It's turtles! And it's all the way down
-
Mar 16th, 2006, 04:00 AM
#6
Re: Trigonometry and Vectors
Morning,
It depends on what your U and V are. Are they velocities? Distances? Coordinates? If you haven't been given any other information, then you have to assume that they're supposed to be velocities. If they're perpendicular, then you can use Pythagoras and tan to get teh angle, as you say, but you won't get 45 degrees nor will you get hypotenuse of 11. Tan 45 = 1, so opposite must = adjacent.
The alternative is that these velocities aren't perpendicular. In that case though, you need to assume one or other of the speed or angle and try to work out the other. Obviously, if they aren't perpendicular and can be at any angle then the resultant vector can be any length you like between 1 (where the vectors are in opposite directions) to 7.6 (where they add).
zaza
-
Mar 16th, 2006, 04:08 AM
#7
Re: Trigonometry and Vectors
If these two represent perpendicular velocities pointing at the origin, then the length of the resultant vector is, as you say, from Pythagoras 5.42. If this is in metres/second, then this translates to 10.53 knots or 12.12 mph.
The angle between the two is atan (3.3/4.3) = 37.5 degrees north of east (i.e. if east was the x axis, go 37.5 degrees to the north). And it's pointing towards the origin. Hence the wind is coming from the NE at a speed of 10.53 knots.
Close enough?
zaza
-
Mar 16th, 2006, 04:09 AM
#8
Thread Starter
Frenzied Member
Re: Trigonometry and Vectors
Thanks, still no closer to figuring out where to even start. I have another example (so the two together give)
u=-4.4,v=-0.7 means E, 9mph
u=-4.3,v=-3.3 means NE 11mph
"As far as the laws of mathematics refer to reality, they are not certain; and as far as they are certain, they do not refer to reality." - Albert Einstein
It's turtles! And it's all the way down
-
Mar 16th, 2006, 04:09 AM
#9
Thread Starter
Frenzied Member
Re: Trigonometry and Vectors
 Originally Posted by zaza
If these two represent perpendicular velocities pointing at the origin, then the length of the resultant vector is, as you say, from Pythagoras 5.42. If this is in metres/second, then this translates to 10.53 knots or 12.12 mph.
The angle between the two is atan (3.3/4.3) = 37.5 degrees north of east (i.e. if east was the x axis, go 37.5 degrees to the north). And it's pointing towards the origin. Hence the wind is coming from the NE at a speed of 10.53 knots.
Close enough?
zaza
I posted my last before I caught the your last. Cheers zaza, will run through some examples and report back
"As far as the laws of mathematics refer to reality, they are not certain; and as far as they are certain, they do not refer to reality." - Albert Einstein
It's turtles! And it's all the way down
-
Mar 16th, 2006, 04:12 AM
#10
Re: Trigonometry and Vectors
In your second example, the length of the hypotenuse is sqrt(0.7^2 + 4.4^2) = 4.455m/s. This converts to 8.66 knots or 9.97 mph.
The angle between them is atan 0.7/4.4 = 9.03 degrees. And both vectors point towards the origin (being negative), so the resultant is also pointing towards the origin, more ore less from the East.
zaza
-
Mar 16th, 2006, 04:19 AM
#11
Re: Trigonometry and Vectors
If this is correct, then the way to think about it is the following. Imagine starting at the origin. Move along the x axis (W to E) by the magnitude of U (-U means head West). Then move along the Y axis (S to N) by the magnitude of V (-V means head South). The resultant vector from the origin to where you now are is the direction in which the wind is travelling (i.e. in the first example it is travelling roughly SW, so coming from the NE). The magnitude is obtained by Pythagoras (root of the sum of the squares) and is in m/s, which must be converted into knots. The angle is obtained by inverse tan of V/U and represents the angle that the wind is coming from relative to East towards North. So 37.5 degrees is roughly from the North East.
Does that give roughly the right results.
zaza
-
Mar 16th, 2006, 05:42 AM
#12
Thread Starter
Frenzied Member
Re: Trigonometry and Vectors
Yeah that gives good results, thanks. Last part is to transform this vector into an angle from 0-360. Is there already some mathematical method for doing this? Or is it simply a list of If/Thens ?
"As far as the laws of mathematics refer to reality, they are not certain; and as far as they are certain, they do not refer to reality." - Albert Einstein
It's turtles! And it's all the way down
-
Mar 16th, 2006, 06:17 AM
#13
Thread Starter
Frenzied Member
Re: Trigonometry and Vectors
VB Code:
Function DeriveWind(x As Double, y As Double, h As Double, v As Double)
Const RAD_2_DEG As Double = 57.295780490443 '(180/PI)
Dim px As Boolean
Dim py As Boolean
' Get wind speed in m/s, and convert to mph
v = Sqr(x * x + y * y) * 2.24
' Work out wind direction
h = Atn(Abs(y) / Abs(x)) * RAD_2_DEG
' Figure out which quadrant the vector is in and
' convert to compass angles (between 0-360) to return heading
px = Sgn(x) = 1
py = Sgn(y) = 1
If px And py Then
h = 180 + h
End If
If px And Not py Then
h = 270 + h
End If
If Not px And py Then
h = 90 + h
End If
If Not px And Not py Then
h = 90 - h
End If
End Function
Here's the resultant code. If anyone can improve on the messy if, then, elses at the end I'd be eternally grateful.
Cheers
"As far as the laws of mathematics refer to reality, they are not certain; and as far as they are certain, they do not refer to reality." - Albert Einstein
It's turtles! And it's all the way down
-
Mar 16th, 2006, 06:52 PM
#14
Re: [Resolved] Trigonometry and Vectors
You don't return a value and you haven't used V
-
Mar 17th, 2006, 03:13 AM
#15
Thread Starter
Frenzied Member
Re: [Resolved] Trigonometry and Vectors
 Originally Posted by penagate
You don't return a value and you haven't used V 
I wonder what ' v = Sqr(x * x + y * y) * 2.24' that does, then?
True - it should be a sub.
"As far as the laws of mathematics refer to reality, they are not certain; and as far as they are certain, they do not refer to reality." - Albert Einstein
It's turtles! And it's all the way down
-
Mar 17th, 2006, 05:20 AM
#16
Re: [Resolved] Trigonometry and Vectors
You don't return a value and you have used V 
Didn't see it.
-
Mar 17th, 2006, 05:49 AM
#17
Re: [Resolved] Trigonometry and Vectors
Morning,
You need to handle x=0 as well, otherwise you will have to calculate atan(infinity).
Here is some code taken from my Coordinates and Vectors link...
VB Code:
If coordin.X = 0 Then 'Handle X=0
If coordin.Y > 0 Then
coordout.Theta = PI / 2
ElseIf coordin.Y < 0 Then
coordout.Theta = 3 * PI / 2
Else
coordout.Theta = 0
End If
Else
If coordin.X > 0 And coordin.Y >= 0 Then 'If in +/+ quadrant
coordout.Theta = Atan(coordin.Y / coordin.X)
ElseIf coordin.X > 0 And coordin.Y < 0 Then 'If in +/- quadrant, need large angle
coordout.Theta = (2 * PI) + Atan(coordin.Y / coordin.X)
Else 'In negative quadrants
coordout.Theta = PI + Atan(coordin.Y / coordin.X)
End If
End If
It takes x and y and returns theta, where theta is in radians and runs from 0 to 2Pi.
zaza
-
Jul 19th, 2006, 09:14 AM
#18
Thread Starter
Frenzied Member
Re: [Resolved] Trigonometry and Vectors
Changed it a bit, but now get exactly the values I need without resorting to nasty IF, THEN, ELSES . . .
VB Code:
Public Sub DeriveWind(ByVal u As Single, ByVal v As Single)
'a=(u,v)
'b=(0,1)
Dim ma As Single ' |a|
Dim m As Single
Dim d As Single
' Get wind speed (magnitude) and convert it to mph
ma = Sqr(u * u + v * v)
m = ma * 2.24
' Get angle(d) difference between a, and b
' because cos(d) = a.b/|a||b|, therefore d = arccos(a.b/|a||b|)
' simplified d = arccos(v/|a|)
d = 360 - (ArcCos(v / ma) * 57.295780490443)
Debug.Print d, m
"As far as the laws of mathematics refer to reality, they are not certain; and as far as they are certain, they do not refer to reality." - Albert Einstein
It's turtles! And it's all the way down
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|