# Calculating Vx and Vy given V, X, Y

#### Darkbound

Homework Statement
Calculating Vx and Vy ratio to always have a constant given V
Homework Equations
x(t) = x0 + v0 * cos(alpha) * t
y(t) = y0 + v0 * sin(alpha) * t
I have a problem where I am given a trajectory by x(t), y(t) and I am given a constant speed throught the whole trajectory. I need to find vx and vy.
Equations that I am given:
x(t) = 1.5 + 0.5 * t * cos(8*pi*t)
y(t) = 1.5 + 0.5 * t * sin(8*pi*t)
v0 = 0.5

What I have tried to do is use the 1D constant acceleration equations to figure out what the angle of the velocity is:
x(t) = x0 + v0 * cos(alpha) * t

Then I equalized the two x(t) equations:
x0 + v0 * cos(alpha) * t = 1.5 + 0.5 * t * cos (8 * pi * t)

From here, alpha:
alpha = arccos(1.5/(v0*t) + (0.5*cos(8 * pi * t))/v0 - x0/(v0 * t)

I am assuming that x0 in the equation is a given point calculated by my initial x(t) equation
I have tried to calculate the angle with MATLAB:

t = 0:0.001:1;
x0 = 1.5 + 0.5 .* t.* cos(8 .* pi .* t);
y0 = 1.5 + 0.5 .* t.* sin(8 .* pi .* t);
v0 = 0.5;

for n = 1:size(t, 2)
alpha(n) = acos(1.5/(v0*t(n)) + 0.5 * cos(8*pi*t(n))/v0 - x0(n)/(v0*t(n)));
end

From here I am calculating:
vx = v0 * cos(alpha)
vy = v0 * sin(alpha)

And vx is always 0, vy is always 0.5 and that is because all I get for the angle is 90 degrees at all times. I am assuming that either the way I calculate it within the loop is wrong, or my approach to the equations themselves is wrong, but I can't figure out exactly where my problem is.

Again, what I want is to find how Vx and Vy change while the point moves through the given trajectory, it must always move at a constant velocity, the only thing that is changing is the ratio between Vx and Vy to maintain that velocity, 0.5 = sqrt(vx^2 + vy^2) that should be true at all times.

Related Introductory Physics Homework Help News on Phys.org

#### PeroK

Homework Helper
Gold Member
2018 Award
As an alternative approach: how is velocity related to position?

#### Darkbound

Velocity is the first derivative of the position... So I should take the first derivatives of the equations of the trajectory that I have and then do 0.5^2 = derivative(x)^2 + derivative(y)^2 and that will be an equation with t as unknown in it solve for t and then plug t's back into the derivatives to get the actual velocities?

#### PeroK

Homework Helper
Gold Member
2018 Award
Velocity is the first derivative of the position... So I should take the first derivatives of the equations of the trajectory that I have and then do 0.5^2 = derivative(x)^2 + derivative(y)^2 and that will be an equation with t as unknown in it solve for t and then plug t's back into the derivatives to get the actual velocities?
This problem is unclear to me. First, are your equations:

$x(t) = x_0 + v_0 \cos(\alpha t)$

or

$x(t) = x_0 + v_0 (\cos(\alpha))t$

In both cases these represent motion at constant speed. Is the problem to show this? Can you describe the motion in each case?

#### Darkbound

Ok I will try to expain it again. The motion is two (actually three dimensional, but for simplicity I am keeping it to 2 for now). I have x and y equations, these are the first equations that I wrote in my post, the second x, y equations I've taken from the 1D constant acceleration equations, but without acceleration.
The goal is to maintain a constant speed throughout the whole trajectory, lets say that this is 0.5 m/s.
Now if the motion is along the x axis only or along the y axis only, thats simple, but with the equations that I have, the motion is along both axes and thats a spiral. So Vx and Vy are different at any given moment in time, but they should always be equal to a total speed of 0.5m/s. I need to find these ratios, I need to output the graphs of Vx and Vy versus t, thats my end goal. So V versus t should be a constant, 0.5 at any given moment in time, but Vx and Vy are changing, they always end up at V = 0.5 but the ratio changes between them would change.

#### PeroK

Homework Helper
Gold Member
2018 Award
Ok I will try to expain it again. The motion is two (actually three dimensional, but for simplicity I am keeping it to 2 for now). I have x and y equations, these are the first equations that I wrote in my post, the second x, y equations I've taken from the 1D constant acceleration equations, but without acceleration.
The goal is to maintain a constant speed throughout the whole trajectory, lets say that this is 0.5 m/s.
Now if the motion is along the x axis only or along the y axis only, thats simple, but with the equations that I have, the motion is along both axes and thats a spiral. So Vx and Vy are different at any given moment in time, but they should always be equal to a total speed of 0.5m/s. I need to find these ratios, I need to output the graphs of Vx and Vy versus t, thats my end goal. So V versus t should be a constant, 0.5 at any given moment in time, but Vx and Vy are changing, they always end up at V = 0.5 but the ratio changes between them would change.
That's where the properties of the sine and cosine come in useful.

On the other hand, what is wrong with simply keeping $v_x$ and $v_y$ constant?

#### Darkbound

Is that even possible? If vx is lets say 0.1 m/s and vy 0.4 m/s at all times, wouldnt that make the trajectory simply a line?

Last edited:

#### haruspex

Homework Helper
Gold Member
2018 Award
Relevant Equations: x(t) = x0 + v0 * cos(alpha) * t
y(t) = y0 + v0 * sin(alpha) * t

x(t) = 1.5 + 0.5 * t * cos(8*pi*t)
y(t) = 1.5 + 0.5 * t * sin(8*pi*t)
So $\alpha$ is a function of time, right? Specifically, $\alpha(t)=8\pi t$? But there is no way that will give a constant velocity, so you must have "given equations" wrong.

#### Darkbound

No it will not give a constant velocity, that is precisely what i am saying, the velocities along each respecitve axis are NOT constant, but when you use each of these individual velocities to calculate the total speed, the total speed should be constant at all times, so at a given moment in time vx may be larger than vy, but in the end its still 0.5, then in another moment in time, vy may be larger than vx, but its still a total speed of 0.5. You are looking at just one of the equations and not at both of them.

#### haruspex

Homework Helper
Gold Member
2018 Award
No it will not give a constant velocity, that is precisely what i am saying, the velocities along each respecitve axis are NOT constant, but when you use each of these individual velocities to calculate the total speed, the total speed should be constant at all times, so at a given moment in time vx may be larger than vy, but in the end its still 0.5, then in another moment in time, vy may be larger than vx, but its still a total speed of 0.5. You are looking at just one of the equations and not at both of them.
Sorry, I meant it will not give you a constant speed.

#### Darkbound

Im sorry, either I dont understand you, or you dont understand me.
Lets say we have a vector V that is the our desired speed of the point when it moves through the given trajectory (regardless of what the trajectory is). This vector has 2 components, Vx and Vy. There are infinite amount of combinations between Vx and Vy that will always give the desired length of the vector V (the length of that vector is our desired speed). I need to find exactly what these combinations are for my trajectory (or any other trajectory), such that, when we use these combinations to calculate the length of V, its always 0.5

#### Darkbound

I have attached an image to this post, I hope that this clarifies what I mean. I need to find vx and vy such that they always make the same v vector, as you can see, the vector always has the same length, but vx and vy can change in different moments of time

#### Attachments

• 83.9 KB Views: 42

#### haruspex

Homework Helper
Gold Member
2018 Award
Im sorry, either I dont understand you, or you dont understand me.
Lets say we have a vector V that is the our desired speed of the point when it moves through the given trajectory (regardless of what the trajectory is). This vector has 2 components, Vx and Vy. There are infinite amount of combinations between Vx and Vy that will always give the desired length of the vector V (the length of that vector is our desired speed). I need to find exactly what these combinations are for my trajectory (or any other trajectory), such that, when we use these combinations to calculate the length of V, its always 0.5
You give the position coordinates as $x=x_0+ct\cos(\omega t)$ and $y=y_0+ct\sin(\omega t)$, where c and ω are constants.
That leads to $\dot x= c\sin(\omega t)+ct\omega\cos(\omega t)$ and $\dot y= c\cos(\omega t)-ct\omega\sin(\omega t)$.
Hence $v^2=c^2 +c^2t^2\omega^2$.
How is that going to be constant?

I see two possibilities:
Someone has incorrectly specified the coordinate equations, or
The 't' in the coordinate equations is just an arbitrary parameter, not time.

#### Darkbound

Yes, thats what I was thinking about now, t is not time its a parameter, I was using it to calculate each of the points of the motion, so its not actual time.

#### haruspex

Homework Helper
Gold Member
2018 Award
Yes, thats what I was thinking about now, t is not time its a parameter, I was using it to calculate each of the points of the motion, so its not actual time.
Ok, so rewrite my algebra in post #13 on that basis.

Edit: but to avoid confusion, maybe use a different label for the parameter.

#### Darkbound

The equations of a conical helix (what I am trying to use as my trajectory) are
x = t*cos(c*t)
y = t*sin(c*t)
z = t
(taken from here http://www.mathematische-basteleien.de/spiral.htm)
Where c is a constant
In my calculations I was simply creating t as a vector of values from 0 to 1 and using it to calculate the x y z values. The derivatives of these equations would yield the same result as yours, I dont know what I am missing, or what is wrong in my formulation of the problem.

#### haruspex

Homework Helper
Gold Member
2018 Award
The equations of a conical helix (what I am trying to use as my trajectory) are
x = t*cos(c*t)
y = t*sin(c*t)
z = t
(taken from here http://www.mathematische-basteleien.de/spiral.htm)
Where c is a constant
In my calculations I was simply creating t as a vector of values from 0 to 1 and using it to calculate the x y z values. The derivatives of these equations would yield the same result as yours, I dont know what I am missing, or what is wrong in my formulation of the problem.
Please try to do as I asked in post #15. I suggest using z as the parameter instead of t, to avoid confusion with time.

#### Darkbound

I dont want to mix the equations, they should not be dependent on each other (e.g. x on z or y on z or z on x), because I want to use the same approach for different sets of equations. If I take their derivatives as they currently are I will get the same result as yours
dx/dt = cos(c*t) - c*t*sin(c*t)
dy/dt = sin(c*t) + c*t*cos(c*t)
dz/dt = 1
And there are multiple problems here regarding my problem, first if vz is 1 then the total v can never be 0.5 Also the c*t* infront of the cos and sin will make them increase at all times (which is what I have already observed while attempting this)
I dont know what I am missing, or what is wrong in my formulation of the problem, or what is wrong in my equations, but these are the equations of a conical helix, it is certainly possible to go at a constant speed through the trajectory, through any trajectory, I just dont know what am I missing

#### haruspex

Homework Helper
Gold Member
2018 Award
dx/dt = cos(c*t) - c*t*sin(c*t)
dy/dt = sin(c*t) + c*t*cos(c*t)
dz/dt = 1
This is the confusion you need to avoid. To end up with an expression for speed, the t you need in dx/dt is time, not the parameter t in the equations.
If you don't want to use z, pick something else. r, s, something.

#### PeroK

Homework Helper
Gold Member
2018 Award
Yes, thats what I was thinking about now, t is not time its a parameter, I was using it to calculate each of the points of the motion, so its not actual time.
And how was anyone else supposed to know that?

#### Darkbound

This is the confusion you need to avoid. To end up with an expression for speed, the t you need in dx/dt is time, not the parameter t in the equations.
If you don't want to use z, pick something else. r, s, something.
I still don't understand what my equations should look like

#### haruspex

Homework Helper
Gold Member
2018 Award
I still don't understand what my equations should look like
1. Rewrite your equations for x and y in post #16 using u as the parameter instead of t.
2. Differentiate them wrt to time, remembering that u varies with time.
3. Obtain an expression for v2
4. Solve the resulting differential equation.

#### Darkbound

1. Rewrite your equations for x and y in post #16 using u as the parameter instead of t.
2. Differentiate them wrt to time, remembering that u varies with time.
3. Obtain an expression for v2
4. Solve the resulting differential equation.
So, the equations should become like this:
x = u(t) * cos(c*u(t))
y = u(t) * sin(c*u(t))
z = u(t)

Is this correct?

And now I need another equation for u, which binds u that goes from 0 to 1 with respect to time, which can be from 0 to 10 (for example)? And time I will be calculating based on the speed that I want and the length of the trajectory, how do I make the u equation is my unknown at this point

Last edited:

#### haruspex

Homework Helper
Gold Member
2018 Award
now I need another equation for u
No you don't. Just differentiate those equations to find the velocity components and hence the overall speed.

#### Darkbound

No you don't. Just differentiate those equations to find the velocity components and hence the overall speed.
I tried to do that and I ended up with an equation of the sort of du/dt * C = 0, it was a veeeeery long equation in the beginning but all sines/cosines etc got cancelled in one way or another.
Where C is v/(sqrt(c+2)) if I recall correctly (I dont have the papers infront of me).

Last edited:

### Want to reply to this thread?

"Calculating Vx and Vy given V, X, Y"

### Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving