⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 trajectory.m

📁 This function is used to evaluate the max height and the max distance of a projectile and plot th
💻 M
字号:
function [hmax,dmax] = trajectory(v0,theta)% This function is used to evaluate the max height and the max% distance of a projectile and plot the trajectory.% Inputs% v0   : The initial velocity in m/s% theta: The angle at which the projectile is fired in degrees% Outputs% hmax : The maximum hieght in m% dmax : The maximum distance in mg = 9.81;v0x = v0*cos(theta*pi/180);v0y = v0*sin(theta*pi/180);thmax = v0y/g;hmax = v0y^2/(2*g);ttol = 2*thmax;dmax = v0x*ttol;% Create the plot of the trajectorytplot = linspace(0,ttol,200);x = v0x*tplot;y = v0y*tplot - 0.5*g*tplot.^2; %.^2 for element multiplicationplot(x,y)xlabel('Distance(m)')ylabel('Height(m)')title('Projectile Trajectory')% 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -