trouver un angle avec l'equation de trajectoire d'un projectile

6 Ansichten (letzte 30 Tage)
Franck Aurel
Franck Aurel am 22 Mär. 2025
Bearbeitet: David Goodmanson am 26 Mär. 2025
Bonjour, j'ai un probleme avec ma conception d'un projet de cours j'aimerais calculé l'angle adequat pour mon projectile avec un x0 et y0 en fonction de x mais matlab me donne aucune reponse. voici ce que je recois comme resultat. merci
  2 Kommentare
Torsten
Torsten am 23 Mär. 2025
Bearbeitet: Torsten am 23 Mär. 2025
You can compute theta as a function of x and t, but how should it be possible to compute theta solely as a function of x ?
Vous pouvez calculer thêta en fonction de x et t, mais comment serait-il possible de calculer thêta uniquement en fonction de x ?
Franck Aurel
Franck Aurel am 23 Mär. 2025
Bearbeitet: Torsten am 23 Mär. 2025
J ai deja compris t dans l equation en trouvant t en fonction de y et theta et vu que a l arrivée y=0 on a juste y0 dans l equation donc cette forme d equation prends en compte t x et y deja
I already included t in the equation by finding t as a function of y and theta and seeing that at the end y=0 we just have y0 in the equation so this form of equation takes into account t x and y already

Melden Sie sich an, um zu kommentieren.

Antworten (2)

Torsten
Torsten am 23 Mär. 2025
Bearbeitet: Torsten am 23 Mär. 2025
x0 = 0.08;
y0 = 0.05;
v0 = 2;
g = 9.81;
syms t x theta
eqn1 = x == v0*t*cos(theta) + x0;
eqn2 = 0 == v0*t*sin(theta) - 0.5*g*t^2 + y0;
sol = solve([eqn1,eqn2],[t,theta],'MaxDegree',4);
simplify(sol.t)
ans = 
simplify(sol.theta)
ans = 
  3 Kommentare
Torsten
Torsten am 23 Mär. 2025
Of course, x must be chosen such that the point (x,0) can be reached by a certain angle for theta.
If this is the case, I suspect that two solutions will give imaginary values and the third solution will give a negative time so that only one physically senseful solution will remain.
Bien sûr, x doit être choisi de telle sorte que le point (x, 0) puisse être atteint sous un certain angle pour thêta.
Si tel est le cas, je suppose que deux solutions donneront des valeurs imaginaires et que la troisième solution donnera un temps négatif, de sorte qu'il ne restera qu'une seule solution physiquement sensée.
Franck Aurel
Franck Aurel am 23 Mär. 2025

Merci beaucoup j’avais pas pensé à séparer les equations

Melden Sie sich an, um zu kommentieren.


David Goodmanson
David Goodmanson am 24 Mär. 2025
Bearbeitet: David Goodmanson am 26 Mär. 2025
The syms solutions are getting out of hand, which is not all that unusual. The kinematic equations evidently are for a projectile lauched from location [-x0,y0] and striking the ground to the right at a specified [x,0]:
-x0 + v0*c*t = x % c = cos(theta)
y0 + v0*s*t -(1/2)*g*t^2 = 0 % s = sin(theta)
The first equation is
-(x+x0) + v0*c*t = 0
The total specified displacement in the x direction is (x+x0) so renaming that quantity as a new x0 then
-x0 + v0*c*t = 0 % c = cos(theta)
y0 + v0*s*t -(1/2)*g*t^2 = 0 % s = sin(theta)
which describes a projectile lauched from location [-x0,y0] and striking the ground to the right at [0,0]. The total displacement is the only x quantity to worry about. That's another way of saying that since there are no external forces in the x direction, there is translational symmetry in x.
Instead of solving the second equation for t and plugging it into the first one, it's better to do it the other way round:
t = x0/(v0*c)
y0 + v0*(x0/v0*c) - (1/2)*g*(x0/(v0*c))^2 = 0
or
y0 + x0*(s/c) -(1/2)*(g/v0^2)*x0^2*(1/c^2) = 0
define the distance
b = 2*v0^2/g
go to s/c = tg % tan(theta)
and use the identity (1/c^2) = (1+tg^2) to obtain
y0 + x0*tg - (x0^2/b)*(1+tg^2) = 0
or
y0-(x0^2/b) + x0*tg - (x0^2/b)*tg^2 = 0
then find the roots of this quadratic in tan(theta) and proceed from there.
There are two solutions, a 'slow' one where the projectile arcs up and takes a while to arrive, and a 'fast' one where the projectile is pointed below the local horizon at y0.
x = 0; % for example
x0 = 0.08 + x; % new x0 is total x displacement
y0 = 0.05;
v0 = 2;
g = 9.81;
b = 2*v0^2/g
tg = roots([x0^2/b,-x0,x0^2/b-y0]) % two values
theta = atand(tg) % result in degrees
b = 0.8155
tg =
10.6958
-0.5022
theta =
84.6587
-26.6641
% check
t = x0./(v0*cosd(theta))
y0 + v0*sind(theta).*t - (1/2)*g*t.^2 % should be zero
t =
0.4297
0.0448
ans =
1.0e-15 *
0.2220
-0.0017

Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by