Trajectory of moving objects(I)
Given the forces of objects and initial displacement/velocity, we can determine the trajectory as a function of time by the iteration. Here we focus on the case of one-dimension, considering the effect of friction force and many particle interactions.
(1) the effect of friction force
When the friction force is given above, the code shoulbe modified at the updating of velocity.
Without friction, the velocity will increase as the time gradually, while there is a limit when the friction is considered.
(2) spring oscillator
For the ideal spring oscillator, we can obtain the equation when the friction of ground is neglected. Suppose the elastic coefficient k=1 and the initial displacement s(t=0)=0.1.
clear k=1;s(1)=0.1;v(1)=0; t(1)=0;dt=0.1; for i=1:1000 v(i+1)=v(i)-k*s(i)*dt; s(i+1)=s(i)+v(i+1)*dt; t(i+1)=t(i)+dt; endfor
After the iteration, we can plot the displacement or velocity as a function of time.
(3) case of two objects
When there are two objects, we can write down the equations respectively. Suppose the free length of string is L=1, the force can be calculated according to the difference between L and the distance of object 1,2.
clear k=1;s1(1)=0;v1(1)=1; s2(1)=-1;v2(1)=0; t(1)=0;dt=0.1; for i=1:100 v1(i+1)=v1(i)-k*(s1(i)-s2(i)-1)*dt; v2(i+1)=v2(i)+k*(s1(i)-s2(i)-1)*dt; s1(i+1)=s1(i)+v1(i+1)*dt; s2(i+1)=s2(i)+v2(i+1)*dt; t(i+1)=t(i)+dt; endfor
After the iteration, we can obtain the displacement of 1 and 2 as a function of time (shown on the left). The figure on the right is the distance of 1 and 2, which shows a typical trajectory of single spring oscillator.
plot(t,s1,'o-') hold on plot(t,s2,'ro-') xlabel('time') ylabel('displacement') figure plot(t,s1-s2,'o-')
原文地址:https://www.cnblogs.com/xbyang99/p/11733176.html
- 详析JSONP跨域
- Android Binder漏洞挖掘技术与案例分享
- Stanford机器学习笔记-5.神经网络Neural Networks (part two)
- 监控平台前端SDK开发实践
- 一步步实现静态页面布局
- Stanford机器学习笔记-3.Bayesian statistics and Regularization
- 在R中使用支持向量机(SVM)进行数据挖掘
- 【你问我答】你与Java大牛的距离,只差这24个问题
- Android漏洞扫描工具Code Arbiter
- Huawei HG532 系列路由器远程命令执行漏洞分析
- postMessage与postMessage跨域
- 【手把手教你做项目】自然语言处理:单词抽取/统计
- D-Link系列路由器漏洞挖掘入门
- 大家一直在谈的领域驱动设计(DDD),我们在互联网业务系统是这么实践的
- JavaScript 教程
- JavaScript 编辑工具
- JavaScript 与HTML
- JavaScript 与Java
- JavaScript 数据结构
- JavaScript 基本数据类型
- JavaScript 特殊数据类型
- JavaScript 运算符
- JavaScript typeof 运算符
- JavaScript 表达式
- JavaScript 类型转换
- JavaScript 基本语法
- JavaScript 注释
- Javascript 基本处理流程
- Javascript 选择结构
- Javascript if 语句
- Javascript if 语句的嵌套
- Javascript switch 语句
- Javascript 循环结构
- Javascript 循环结构实例
- Javascript 跳转语句
- Javascript 控制语句总结
- Javascript 函数介绍
- Javascript 函数的定义
- Javascript 函数调用
- Javascript 几种特殊的函数
- JavaScript 内置函数简介
- Javascript eval() 函数
- Javascript isFinite() 函数
- Javascript isNaN() 函数
- parseInt() 与 parseFloat()
- escape() 与 unescape()
- Javascript 字符串介绍
- Javascript length属性
- javascript 字符串函数
- Javascript 日期对象简介
- Javascript 日期对象用途
- Date 对象属性和方法
- Javascript 数组是什么
- Javascript 创建数组
- Javascript 数组赋值与取值
- Javascript 数组属性和方法
- 佳能遭严重勒索软件攻击,10TB数据被窃取,大量服务宕机
- 进程线程剖析(二)-进程组成、状态与特点
- 【Flink】基于 Flink 实时计算商品订单流失量
- 这就是你日日夜夜想要的docker!!!---------TLS加密远程连接Docker
- 【Flink】基于 Flink 的流式数据实时去重
- 从零开始安装穿透式检索
- 使用kind搭建kubernetes
- 如何设计一个牛逼的API接口
- 猿实战17——实现你未必知晓的运费模板
- 这 5 个 VSCode 扩展提高你的开发效率
- 猿实战18——商品发布之类目选择
- 树莓派基础实验1:双色LED灯实验
- 【机器学习基础】机器学习中类别变量的编码方法总结
- 树莓派基础实验2:RGB-LED实验
- 【Python基础】Python画王者荣耀英雄能力雷达图