找回密码
 注册
Simdroid-非首页
查看: 75|回复: 0

Newmark单自由度,自己写的,大家批评指正

[复制链接]
发表于 2012-3-31 10:44:56 | 显示全部楼层 |阅读模式 来自 黑龙江哈尔滨
%%%%Newmark method: linear systems,single degree freedom
clc
clear all
close all
%%%%intial values of the caculated system
m=0.2533;
c=0.1592;
k=10;
%%%%the expression of excitation
syms t
p=10*sin(pi*t/0.6);
%%%%intial caculation
t0=0.6;     %the end of the excitation
total=1.0;   %totla caculation time
dt=0.1;     %time step
n=total/dt;
n1=t0/dt;
u1=0;
v1=0;
gama=0.5;
beta=1/6;
a1=(subs(p,0)-c*v1-k*u1)/m;
keq=k+gama*c/beta/dt+m/beta/dt^2;
x=m/beta/dt+gama*c/beta;
y=m/2/beta+c*dt*(gama/2/beta-1);
x0=gama/beta/dt;
x1=gama/beta;
x2=dt*(1-gama/2/beta);
x3=1/beta/dt^2;
x4=1/beta/dt;
x5=1/2/beta;
%%%%form the vector of the%%%%
u(1)=u1;
v(1)=v1;
a(1)=a1;
%%%%for every time step%%%%
for i=1:1:n
    if i<n1+1     
        pt=p;
    else
        pt=0;
    end
    dp(i)=subs(pt,i*dt)-subs(pt,(i-1)*dt);
    dpeq(i)=dp(i)+x*v(i)+y*a(i);
    du(i)=dpeq(i)/keq;
    dv(i)=x0*du(i)-x1*v(i)+x2*a(i);
    da(i)=x3*du(i)-x4*v(i)-x5*a(i);
    u(i+1)=u(i)+du(i);
    v(i+1)=v(i)+dv(i);
    a(i+1)=a(i)+da(i);
end
%%%%to figure out the caculation result
t1=0:dt:total;
plot(t1',u(:,1:n+1))   %the value corresponding to u(1) is not real
此程序参考的是《结构动力学:理论及其在地震工程中的应用》一书的Newmark法
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Simapps系列直播

Archiver|小黑屋|联系我们|仿真互动网 ( 京ICP备15048925号-7 )

GMT+8, 2024-10-2 01:35 , Processed in 0.030564 second(s), 11 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表