Can someone help me with this homework

3 vues (au cours des 30 derniers jours)
A
A le 28 Nov 2022
Commenté : A le 28 Nov 2022
hi can someone help me
USE matlab determine the trajectory of the oblique throwing motion in a gravity field with environmental resistance
With initial conditions
.Mission
Build Matlab program:
1) Enter the values m, h, v0, , t (duration of flight).
2) Set up differential equations for x(t) and y(t). Use symbolic commands to solve systems of equations.
3) Plot on the same graph of the particle's trajectory with different alpha angles (15, 30, 45, 60, 750), each with a different format (color/stroke).
  1 commentaire
A
A le 28 Nov 2022
function A
%% CONSTANTS
g = 9.81;
%% INPUT DATA
x = 0;
y = 20;
v = 30;
alpha = 60;
t = 0;
dt = 0.01;
%% FIGURE
figure('name','A','color','white','numbertitle','off');
hold on
fig_quanang = plot(x,y,'ro','MarkerSize',10,'markerfacecolor','r');
ht = title(sprintf('t = %0.2f s',t));
axis equal
axis([-1 100 -1 70]);
%% CALCULATION
alpha = alpha/180*pi;
vx = v*cos(alpha);
vy = v*sin(alpha);
while y>-0.01
t = t+dt;
ax = 0;
ay = -g;
vx = vx+ax*dt;
vy = vy+ay*dt;
x = x+vx*dt+0.5*ax*dt.^2;
y = y+vy*dt+0.5*ay*dt.^2;
plot(x,y,'o','markersize',0.5,'color','k');
set(fig_quanang,'xdata',x,'ydata',y);
set(ht,'string',sprintf('t = %0.2f s',t));
pause(0.002);
end
HOW CAN I ADD THE environmental resistance in to this code

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Simulink dans Help Center et File Exchange

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by