闲来无事练练matlab绘图
theta为角度设置了15、30、45、60、75五个值
clear;clc;close;
figure('name','抛体运动');
v0=10;g=9.8;m=5;
theta=15:15:75;
th=theta*pi/180;
x=linspace(0,11,1000);
[TH,x]=meshgrid(th,x);
y=x.*tan(TH)-g*x.^2/v0^2/2./cos(TH).^2;
plot(x,y(:,1))
hold on
plot(x,y(:,2))
hold on
plot(x,y(:,3))
hold on
plot(x,y(:,4))
hold on
plot(x,y(:,5))
hold on
axis([0 11 0 5 ])
title('抛体运动')
xlabel('x/m')
ylabel('y/m')
grid on
效果如下

本文通过使用Matlab编程,展示了如何设置不同角度的抛体运动,并绘制出相应的运动轨迹。通过设置角度从15度到75度,每15度一个间隔,文章详细解释了代码实现过程,包括变量定义、数学公式应用及绘图展示。
439

被折叠的 条评论
为什么被折叠?



