Response_MATLAB

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

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

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];
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

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern