Response_MATLAB

Response_MATLAB - bb=[g;h]; z=inv(AA)*bb; p=z(1:n,1);...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
clear all n=3; x0=[0;1;0]; v0=[0;0;-2]; g=[0;3;0]; h=[0;0;0]; w=4; M=eye(3); C=0*[1 -1 0; -1 1 0; 0 0 0]; k2=2; K=[7+k2 -k2 -4; -k2 k2+3 -3; -4 -3 7]; O=zeros(n,n); I=eye(n,n); A=[O I; -K -C]; B=[I O; O M]; [U,S]=eig(A,B); s1=S(1,1);s2=S(2,2);s3=S(3,3);s4=S(4,4);s5=S(5,5);s6=S(6,6); u1=U(1:n,1);u2=U(1:n,2);u3=U(1:n,3); u4=U(1:n,4);u5=U(1:n,5);u6=U(1:n,6); AA=[K-w^2*M -w*C; w*C K-w^2*M];
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: bb=[g;h]; z=inv(AA)*bb; p=z(1:n,1); q=z(n+1:2*n,1); a=inv(U)*[x0-q;v0-w*p]; k=0; for t=0:0.01:100, k=k+1; ss=0; sss=0; for j=1:2*n ss=ss+a(j,1)*U(1:n,j)*exp(S(j,j)*t); sss=sss+a(j,1)*S(j,j)*U(1:n,j)*exp(S(j,j)*t); end x(:,k)=ss+p*sin(w*t)+q*cos(w*t); v(:,k)=sss+w*p*cos(w*t)-w*q*sin(w*t); T(k,1)=t; end xi=imag(x); vi=imag(v); x=real(x); v=real(v); plot(T,x) grid on...
View Full Document

Ask a homework question - tutors are online