1. function [d,v,a] = Wilson( K, M, C, f, d1, v1, dt, tend )
2. % 利用Wilson-theta 法计算结构的动力响应
3. % [d,v,a] = Wilson( K, M, C, f, d1, v1, dt, tend )
4. % 输入参数
5. % K ----- 刚度矩阵
6. % M ----- 质量矩阵
7. % C ----- 阻尼矩阵
8. % d1 ----- 初始位移
9. % v1 ----- 初始速度
10. % dt ----- 时间步长
11. % tend --- 结束时间
12. % 返回值
13. % d ----- 位移
14. % v ----- 速度
15. % a ----- 加速度
16. [n,n] = size( K ) ;
17. theta = 1.4 ;
18. tao = theta*dt ;
19. alpha0 = 6/tao^2 ;
20. alpha1 = 3/tao ;
21. alpha2 = 2*alpha1 ;
22. alpha3 = tao/2 ;
23. alpha4 = alpha0/theta ;
24. alpha5 = -alpha2/theta ;
25. alpha6 = 1-3/theta ;
26. alpha7 = dt/2 ;
27. alpha8 = dt^2/6 ;
28. K1 = K + alpha0*M + alpha1*C ;
29. d = zeros( n, floor(tend/dt) + 1 ) ;
30. v = zeros( n, floor(tend/dt) + 1 ) ;
31. a = zeros( n, floor(tend/dt) + 1 ) ;
32. d(:,1) = d1 ;
33. v(:,1) = v1 ;
34. a(:,1) = M\(f(:,1)-K*d1-C*v1) ;
35. for i=2:1:floor(tend/dt) + 1
36. t = (i-1)*dt ;
37. ftheta = floor(theta) ;
38. fq = f(i-1+ftheta-1)+ (theta-ftheta)*( f(i+ftheta-1) - f(i+ftheta-2) ) ;
39. f1 = fq + M*(alpha0*d(:,i-1)+alpha2*v(:,i-1)+2*a(:,i-1)) + C*(alpha1*d(:,i-1)+2*v(:,i-1)+alpha3*a(:,i-1)) ;
40. dq = K1\f1 ;
41. a(:,i) = alpha4*(dq-d(:,i-1)) + alpha5*v(:,i-1) + alpha6*a(:,i-1) ;
42. v(:,i) = v(:,i-1) + alpha7 * ( a(:,i) + a(:,i-1) ) ;
43. d(:,i) = d(:,i-1) + dt*v(:,i-1) + alpha8 * ( a(:,i)+2*a(:,i-1) ) ;
45. end
46. return |