How to apply velocity + acceleration to a position?

 채택된 답변

Youssef  Khmou
Youssef Khmou 2014년 11월 27일
편집: Youssef Khmou 2014년 11월 27일

0 개 추천

@Roger gave the solution (Vx,Vy) . try to write a feedback of this solution.
t=0:100e-3:20;
V0x=1000;
Alpha=0.0004;
Beta=0.25;
Vx=1./(Alpha*t+(1/V0x));
Vy=(10/Beta)*(exp(-Beta*t)-1);
x0=10;
y0=15;
x=x0+(1/Alpha)*(log(V0x*Alpha*t+1));
y=(10/Beta)*(-(exp(-Beta*t)/Beta)-t)+y0+(10/Beta^2);
figure; plot(x,y)
title(' Particle Trajectory')
xlabel('x');
ylabel('y');

추가 답변 (2개)

Roger Stafford
Roger Stafford 2014년 11월 26일

1 개 추천

You can approach this problem two ways. One is symbolic and other is numeric. As you are probably aware, you have two entirely independent differential equations here which simplifies things both for the numeric and symbolic methods.
For the symbolic approach you can either use matlab's 'dsolve' function to obtain analytic expressions for x and y versus time t, or you can use your calculus to solve these differential equations by hand. The latter is simple to do. For example, your equation
dvx/dt = -0.0004*vx ^2
can be expressed as
=1/vx^2*dvx = 0.0004*dt
and both sides can easily be integrated.
For the numeric approach you can set up these differential equations to be solved using one of the 'ode' functions. Read about them at:
http://www.mathworks.com/help/matlab/math/ordinary-differential-equations.html
Youssef  Khmou
Youssef Khmou 2014년 11월 26일

0 개 추천

You can verify this primary solution theoretically :
t=0:100e-3:20;
V0x=1000;
Alpha=0.0004;
Beta=0.25;
Vx=1./(Alpha*t-V0x);
Vy=exp(-Beta*t)+10/Beta;
If it is correct, you can integrate for second time to get (x,y)

댓글 수: 5

Roger Stafford
Roger Stafford 2014년 11월 26일
편집: Roger Stafford 2014년 11월 26일
I got somewhat different results, Youssef:
vx = 1/(Alpha*t+1/v0x)
vy = 10/Beta*(exp(-Beta*t)-1) <-- Corrected
Steven
Steven 2014년 11월 26일
편집: Steven 2014년 11월 26일
Hello, when I attempt this code:
t=0:100e-3:20;
V0x=1000;
Alpha=0.0004;
Beta=0.25;
Vx = 1/(Alpha*t+1/V0x) <---
Vy = 10/Beta*(exp(-Beta*t)-1)
The Vx line of code says: Error using / Matrix dimensions must agree.
Not sure why I'm getting this... and which code can I use to integrate a second time?
EDIT: never mind, figured out why it was giving me the error, how can i complete a second integration?
Both of those function should be easy to integrate, Steven. The one with vx leads to the indefinite integral
integral of 1/(k1*t+k2) with respect to t
If you consult an integral table, you will find that this indefinite integral will be a certain logarithm. The second function with vy when integrated gives you another exponential minus a constant times t. Also if you use matlab's 'int' function, it will give you the same result. Although you could have solved them using an 'ode' solver, there is hardly any point with something this simple.
In each of these indefinite integrals you will have to assume some value for the x and y initial values at t = 0 in order to evaluate the constants of integration. At that point you are ready to make your plots. Your line "t=0:100e-3:20;" was premature. It is only needed for making plots unless you intended to do integration using 'trapz', which uses discrete values.
Steven
Steven 2014년 11월 26일
편집: Steven 2014년 11월 27일
Thank you for your help this far. I greatly appreciate it. I'm wondering if my values are the same as yours regarding integrals:
Vxi = 2500*log*(0.0004t-1000),
and
Vyi = -40*t-160 * e^(-0.25t)
When I plot Vxi, the integral of Vx it doesn't seem to start at t=0, is there any reason for this? Vyi seems fine, as it starts the graph at t=0. Is there any way I can make the plot of Vxi start at t=0?
I assume that the symbol 'Vxi' means the same as 'x'. If so, I don't quite agree with your result.
What we have already obtained is the equation
vx = dx/dt = 1/(0.0004*t+0.001)
as the result of the first integration. To find x as a function of t, we need to integrate the expression on the right hand side. Its integral is:
x = 1/0.0004*log(0.0004*t+0.001) + C
where C is the appropriate constant of integration. If you want x to be zero when t is zero, then C must be -1/0.0004*log(0.001), which then gives the final answer of:
x = 1/0.0004*log(0.0004*t+0.001) - 1/0.0004*log(0.001)
= 1/0.0004*(log(0.0004*t+0.001)-log(0.001))
= 1/0.0004*log((0.0004*t+0.001)/0.001)
= 2500*log(0.4*t+1)
Your expression for 'y' ('Vyi') looks basically correct except that it is equal to -160 when t is zero. It needs to have a constant of integration of 160 added if you want it to be zero when t is zero.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Numerical Integration and Differentiation에 대해 자세히 알아보기

제품

태그

질문:

2014년 11월 26일

편집:

2014년 11월 27일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by