- #1
Darkbound
- 22
- 0
- Homework Statement
- Calculating Vx and Vy ratio to always have a constant given V
- Relevant 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.
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.