声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 1770|回复: 0

[线性振动] 欧拉法求解多自由系统响应的MATLAB程序

[复制链接]
发表于 2006-11-21 19:03 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
function [x,xd]=vbr(n,dt,x0,xd0,a,b,c,u)

%  vbr
%  Solves the forced multiples degree of freedom system using Euler's method.  
%  x=vbr(n,dt,x0,a,u)  
%  Solves the system given the initial state vector 'x0',
%                          the state matrix 'a',
%                          the time step to be used 'dt',
%                          and the number of steps to take 'n'.  
%    The force matrix u is ordered such that the nth column of u is the force vector u evaluated at time n*dt.
%  [x,xd]=vbr(n,dt,x0,v0,m,d,k,u)  
%  Solves the system given the initial displacement vector 'x0',
%                          the mass matrix 'm',
%                          the stiffness matrix 'k',
%                          and the damping matrix 'd'.
%    The remaining parameters are as described above.
%  The outputs are in the form of a matrix where each column represents the
%  states a one time step and the rows represent a state as a function of time.

if nargin==8
   la=length(a);
   x0=[x0;xd0];
   a=[zeros(la) eye(la);-a\c -a\b];
   u=[u*0;u];
  else
   u=a;
   a=xd0;
end


% -----------------------------------------------
%             Where the action is.
% -----------------------------------------------
x(:,1)=x0;
for i=2:1:n+1
  x(:,i)=a*dt*x(:,i-1)+x(:,i-1)+dt*u(:,i-1);
end
% -----------------------------------------------
%             Where the action is finished.
% -----------------------------------------------

lx=length(a);
if lx/2==floor(lx/2)
  xd=x(lx/2+1:lx,:);
  x=x(1:lx/2,:);
else
  xd=x;
end

评分

1

查看全部评分

回复
分享到:

使用道具 举报

您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-4-27 23:03 , Processed in 0.120195 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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