惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

aimingoo的专栏
aimingoo的专栏
Engineering at Meta
Engineering at Meta
有赞技术团队
有赞技术团队
博客园_首页
Apple Machine Learning Research
Apple Machine Learning Research
Vercel News
Vercel News
G
Google Developers Blog
Blog — PlanetScale
Blog — PlanetScale
IT之家
IT之家
MongoDB | Blog
MongoDB | Blog
Y
Y Combinator Blog
B
Blog
The GitHub Blog
The GitHub Blog
M
MIT News - Artificial intelligence
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Stack Overflow Blog
Stack Overflow Blog
C
Check Point Blog
Microsoft Azure Blog
Microsoft Azure Blog
D
DataBreaches.Net
I
InfoQ
Recent Announcements
Recent Announcements
阮一峰的网络日志
阮一峰的网络日志
腾讯CDC
H
Help Net Security

博客园 - 遗忘海岸

电磁场中的运动轨迹模拟 圆周运动模拟 带阻力的平抛运动 C# 队列的一些并发模拟 devexpress gridview master,detail视图 focuseRowHandle 同步选中 C# Tcp Server端实现,使用TcpListener 深信服务超融合管理Api调用 GDI+画工作流图的一些总结 绘制贝塞而曲线 GDI+画直线带箭头 devexpress schedulerControl Gantt View 使用 逻辑回归损失函数求导 matplotlim柱状图 匀加速运动模拟python,(matplotlib) C# 实现排列 python 类鸟群Boids C#动态编译 正太分布数据排序后分段数据的方差与标准差 Android 的一个通用列表单选AlertDialog封装
简协运动模拟
遗忘海岸 · 2025-12-19 · via 博客园 - 遗忘海岸

%% simple harmonic motion

clear; clc; close all;
hold on;
grid on;
axis equal;

%% 参数设置
K=10; %弹簧劲度系数 N/m
m=0.2; %震子质量 Kg

t_total = 10;       % 总时间 (s)
dt = 0.0001;          % 时间步长 (s)

%% 数值模拟(欧拉法)
% 初始化数组
n_steps = round(t_total / dt);
t = linspace(0, t_total, n_steps);
x=[];
v=[];
a=[];

x(1)=-0.2; %从负半轴释放
v(1)=0;
a(1)=-x(1)*K;

for i = 1:n_steps-1

  a(i+1)=-x(i)*K;
  v(i+1)=v(i) + a(i) * dt;
  x(i+1)=x(i)+v(i) *dt;

end

subplot(2,2,1)

plot(t, x, 'b-', 'LineWidth', 1);
title('t-x');
grid on
axis equal

subplot(2,2,2)
plot(t, v, 'r-', 'LineWidth', 1);
title('t-v');
grid on
axis equal

subplot(2,2,3)
plot(t, a, 'g-', 'LineWidth', 1);
title('t-a');
grid on
% axis equal

View Code