ek模型的matlab解法,【求助,matlab动力学编程出错】

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

% Input parameters

% kk, cc, mm - stiffness, damping and mass matrices

% fd - Input or forcing influence matrix

% bcdof - Boundary condition dofs vector

% nt - Number of time steps

% dt - Time step size

% q0, dq0 - Initial condition vectors

% Output parameters

% acc - Acceleration response

% vel - Velocity response

% dsp - Displacement response

%--------------------------------------------------------------------------

% (1) initial condition

%--------------------------------------------------------------------------

[sdof,n2]=size(kk);

dsp=zeros(sdof,nt); % displacement matrix

vel=zeros(sdof,nt); % velocity matrix

acc=zeros(sdof,nt); % acceleration matrix

dsp(:,1)=q0; % initial displacement

vel(:,1)=dq0; % initial velocity

theta=1.4; % select the parameters

%--------------------------------------------------------------------------

% (2) Wilson integration scheme for time integration

%--------------------------------------------------------------------------

acc(:,1)=inv(mm)*(fd(:,1)-kk*dsp(:,1)-cc*vel(:,1));

% compute the initial acceleration (t=0)

ekk=kk+mm*(6/(theta*dt)^2)+cc*(3/(theta*dt));

% compute the effective stiffness matrix

for i=1:sdof % assign zero to dsp, vel, acc of the dofs associated with bc

if bcdof(i)==1

dsp(i,1)=0;

vel(i,1)=0;

acc(i,1)=0;

end

end

for it=1:nt % loop for each time step

cfm=dsp(:,it)*(6/(theta*dt)^2)+vel(:,it)*(6/(theta*dt))+2*acc(:,it);

cfc=dsp(:,it)*(3/(theta*dt))+2*vel(:,it)+acc(:,it)*(theta*dt/2);

efd=fd(:,it)+theta*(fd(:,it+1)-fd(:,it))+mm*cfm+cc*cfc;

% compute the effective force vector

dtheta=inv(ekk)*efd; % find the displacement at time t+ dt

acc(:,it+1)=(dtheta-dsp(:,it))*(6/(theta^3*dt^2))...

-vel(:,it)*(6/(theta^2*dt))+acc(:,it)*(1-3/theta);

% find the acceleration at time t+dt

vel(:,it+1)=vel(:,it)+acc(:,it+1)*dt/2+acc(:,it)*dt/2;

% find the velocity at time t+dt

dsp(:,it+1)=dsp(:,it)+vel(:,it)*dt...

+(acc(:,it+1)+2*acc(:,it))*(dt^2/6);

% find the displacement at time t+dt

for i=1:sdof % assign zero to acc, vel, dsp of the dofs associated with bc

if bcdof(i)==1

dsp(i,it+1)=0;

vel(i,it+1)=0;

acc(i,it+1)=0;

end

end

end

if cc(1,1)==0

disp('The transient response results of undamping system')

else

disp('The transient response results of damping system')

end

disp('The method is Wilson integration')

%--------------------------------------------------------------------------

% The end

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值