matlab简单实验,matlab实现简单物理实验模拟

本文通过MATLAB实现两个简单的物理实验模拟:一是模拟球体抛物线轨迹,用户输入速度比例和反弹系数,程序绘制轨迹;二是分析不同质量比下球体碰撞的角度和机械能损失。内容包括ball.m和collision.m两个脚本,详细展示了MATLAB在物理实验模拟中的应用。
摘要由CSDN通过智能技术生成

一.ball.m

clear

vx=input('please input the speed ration of Vx and Vi:');

k=input('coefficient of rebound(<1):');

if k>=1 return,end

tm=(1+k)/(1-k);

xm=vx*tm;

figure

plot([0,xm],[0,0],'LineWidth',3)

grid on

axis equal

axis([0,xm,0,1])

title('Trajectoey of ball','FontSize',16)

xlabel('horizontal distance(m)','FontSize',16)

ylabel('Vertical height(m)','FontSize',16)

dt=0.001;

tm=1;

t=0:dt:tm;

x=2*vx*t;

y=1-t.^2;

i=0;

hold on

while tm>0.01

comet(x,y)

plot(x,y,'LineWidth',2)

i=i+1;

tm=2*k.^i;

t=0:0.001:tm;

x=x(end)+2*vx*t;

y=2*k^i*t-t.^2;<

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值