i need help writing a MatLab code that calculates the max ve

i need help writing a MatLab code that calculates the max vertical and horizontal distances of a projectile with of gravitational constant. I am not sure where to start on setting up a maximum x and y function.

Solution

% given an initianl velocity v0 and an angle theta.

% the maxVmaxH function returns maximum Vertical and maximum Horizontal distances of a projectile.

function [X,Y] = maxVmaxH(v0,theta)

g = 9.81; %gravitational acceleration in m/s^2

V=v0*sind(theta); %vertical component of velocity

U=v0*cosd(theta); %horizontal component of velocity

%check of air resistance present i.e. k is zero or not

flighttime = (2*V)/g ;

t = 0:.1:flighttime ;

y=(((-g.*t)./k)+(((k*V+g)/k^2).*(1-exp(-k.*t))));

y=y./1000;

u=U*exp(-k.*t);

x=(u/k).*(1-exp(-k.*t));

x=x./1000;

v=(V*exp(k.*t))+((g/k).*(exp(-k.*t)-1));

end

i need help writing a MatLab code that calculates the max vertical and horizontal distances of a projectile with of gravitational constant. I am not sure where

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site