newmark-β法matlab程序
时间: 2023-08-02 12:10:20 浏览: 293
以下是使用Newmark-β法编写的MATLAB程序:
```matlab
clc
clear
% 定义质量矩阵
M = \[1, 2, 3, 4\];
m = diag(M);
% 定义刚度矩阵
K = \[800, -800, 0, 0;
-800, 2400, -1600, 0;
0, -1600, 4800, -3200;
0, 0, -3200, 8000\];
% 计算阻尼矩阵
C = 0.05 * m + 0.02 * K;
% 定义力的作用时间和大小
F0 = 100;
t1 = 5;
% 定义时间步长和总步数
dt = 0.01;
nt = 2000;
% 定义Newmark-β法参数
gamma = 0.5;
beta = 0.25;
% 初始化加速度、速度和位移向量
a = zeros(length(M), nt);
v = zeros(length(M), nt);
d = zeros(length(M), nt);
% 计算Newmark-β法系数
a0 = 1 / (beta * dt^2);
a1 = gamma / (beta * dt);
a2 = 1 / (beta * dt);
a3 = 1 / (2 * beta) - 1;
a4 = gamma / beta - 1;
a5 = dt / 2 * (gamma / beta - 2);
a6 = dt * (1 - gamma);
a7 = dt * gamma;
% 初始化时间向量
t = linspace(0, nt * dt, nt);
% 计算力的时间函数
F = zeros(length(M), nt);
for i = 1:nt
if t(i) <= t1
F(:, i) = F0;
end
end
% 进行Newmark-β法计算
for i = 2:nt
a(:, i) = inv(m + a0 * C + a0 * K) * (F(:, i) - C * (a1 * v(:, i-1) + a2 * a(:, i-1)) - K * d(:, i-1));
v(:, i) = v(:, i-1) + a1 * a(:, i) + a2 * a(:, i-1);
d(:, i) = d(:, i-1) + a3 * a(:, i) + a4 * a(:, i-1) + a5 * v(:, i-1) + a6 * v(:, i) + a7 * a(:, i);
end
% 绘制位移函数图像
figure
plot(t, d(1, :))
title('各质点位移总图')
xlabel('s')
ylabel('m')
grid
```
这个程序使用Newmark-β法来计算四层框架结构在顶部受到简谐荷载作用时的响应。程序首先定义了质量矩阵、刚度矩阵和阻尼矩阵。然后根据给定的力的作用时间和大小,计算力的时间函数。接下来,程序使用Newmark-β法进行计算,得到加速度、速度和位移的时间历程。最后,程序绘制了位移函数的图像。
#### 引用[.reference_title]
- *1* [采用Newmark-β法求解振动方程——MATLAB](https://blog.csdn.net/weixin_44563389/article/details/86596159)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* *3* [Newmark数值分析法matlab程序](https://blog.csdn.net/qq_41621140/article/details/113865719)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文