⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vtb4_2

📁 vtoolbox3.5是振动数值模拟工具箱
💻
字号:
function [x,v,t]=vtb4_2(M,K,x0,v0,tf,plotpar)%VTB4_2 Free response of an undamped system.% [x,v,t]=VTB4_2(M,K,x0,v0,tf) will return the displacement (x) and% velocity (v) response for the system described by the mass% matrix M and stiffness matrix K.  The vector of time points, t,% is also returned.  The initial displacement, x0, and initial % velocity, v0, must also be a column vector input into the % function. The response is plotted from zero to final time tf.% [x,v,t]=VTB4_2(M,K,x0,v0,tf,plotpar) will also plot the various % responses depending on the value of plotpar:%% plotpar = 1: plot only displacements (x)% plotpar = 2: plot only velocities (v)% plotpar = 3: plot both displacements and velocitiesif nargin == 5  plotpar=0;endt=0:tf/200:tf;N=length(M);A=[zeros(N) eye(N);-inv(M)*K zeros(N)];B=zeros(2*N,1);IC=[x0;v0];[Ad,Bd]=c2d(A,B,t(2)-t(1));X(1,:)=IC';for i=2:length(t)   X(i,:)=X(i-1,:)*Ad;endx=X(:,1:N);v=X(:,N+1:2*N);%plotting routinesif plotpar~= 0   if plotpar~=2      for i=1:N        plot(t,x(:,i))        ylabel(['Displacement of X',num2str(i)])        xlabel('time (sec)')        title('Press any key to continue')        pause      end   end    if plotpar~=1      for i=1:N        plot(t,v(:,i))        ylabel(['Velocity of X',num2str(i)])        xlabel('time (sec)')        title('Press any key to continue')        pause      end   endend

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -