幽灵诱饵 发表于 2012-4-21 09:41

这个程序怎么运行出来怎么图像是条直线呢?

%This program is for solving the dynamic respones by zhenxing fenjie method
%This program is for the frame structure
clear;
xs=2*0.287;
dzhbo=load ('Centro.txt');
ag=dzhbo*0.01*xs;
dt=0.02;
ndzh=400;
cn=3;
m0=;
k0=;
l=diag(ones(cn));
m=diag(m0);
=matrixju(k0,cn);
=eig(ik,m);
d=diag(sqrt(d));
for i=1:cn
    =min(d);
    xgd(:,i)=x(:,j);
    d(j)=max(d)+1;
end
w=d1;
x=xgd;
a1=2*w(1)*w(2)*(0.05*w(2)-0.07*w(1))/(w(2)^2-w(1)^2);
a2=2*(0.07*w(2)-0.05*w(1))/(w(2)^2-w(1)^2);
for j=1:cn
    x(:,j)=x(:,j)/x(cn,j);
    znbo(j)=(a1+a2*w(j)^2)/2/w(j);
    zhcan(j)=(x(:,j))'*m*l/((x(:,j))'*m*x(:,j));
    =zxzj(znbo(j),w(j),ag);
end
for i=1:cn
    disp1=0;
    accel1=0;
    for j=1:cn
      disp0=zhcan(j)*dlt(j,:)*x(i,j);
      accel0=zhcan(j)*dltacceler(j,:)*x(i,j);
      disp1=disp1+disp0;
      accel1=accel1+accel0;
    end
    disp(i,:)=disp1;
    accel(i,:)=accel1;
end
t=0:dt;ndzh*dt;
subplot(2,2,1)
plot(t,disp(3,:),'k -')
subplot(2,2,2)
plot(t,accel(3,:),'k -')

%This sub-program is solving the dynamic respones of singel degree system
function =zxzj(znb,w,dag)
dt=0.02;
n=399;
x(1)=0;
dx(1)=0;
ddx(1)=0;
s=1+znb*dt*w+w^2*dt^2/6;
for i=1:n
    a(i)=x(i)+dx(i)*dt+ddx(i)*dt^2/3;
    b(i)=dx(i)+ddx(i)*dt/2;
    ddx(i+1)=-1*(dag(i+1)+2*znb*w*b(i)+w^2a*(i))/s;
    dx(i+1)=b(i)+ddx(i+1)*dt/2;
    x(i+1)=a(i)+ddx(i+1)*dt^2/6;
end
bx=x;
acceler=ddx;

%This sun-program is for matrix aggregation of system
function =matrixju(korc,cn)
kcju=zeros(cn);
for i=1:cn-1
    kcju(i,i)=korc(i)+korc(i+1);
    kcju(i.i+1)=-korc(i+1);
    kcju(i+1,i)=-korc(i+1);
end
kcju(cn,cn)=korc(cn)
页: [1]
查看完整版本: 这个程序怎么运行出来怎么图像是条直线呢?