0% found this document useful (0 votes)
30 views3 pages

AME Project 1 Name:: No. Points Score 1 16 2 15 3 23 4 20 5 36 Tot Al 110

This document contains the results of 5 problems from an AME project. Problem 1 defines constants, initializes a matrix A, adjusts it to form matrix K, finds the eigenvalues and eigenvectors of K, and plots the first 3 eigenvectors. It receives a total of 36 points. Problem 2 defines an ODE function that takes a time and state vector as inputs, and returns the time derivative of the state vector based on the system defined by a global matrix K and frequency w0, with an additional forcing term f(t).

Uploaded by

natalie nguyen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views3 pages

AME Project 1 Name:: No. Points Score 1 16 2 15 3 23 4 20 5 36 Tot Al 110

This document contains the results of 5 problems from an AME project. Problem 1 defines constants, initializes a matrix A, adjusts it to form matrix K, finds the eigenvalues and eigenvectors of K, and plots the first 3 eigenvectors. It receives a total of 36 points. Problem 2 defines an ODE function that takes a time and state vector as inputs, and returns the time derivative of the state vector based on the system defined by a global matrix K and frequency w0, with an additional forcing term f(t).

Uploaded by

natalie nguyen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

AME Project 1

Name:

No.

Points

16

15

23

20

36

Tot
al

110

Score

Problem 1
clear all;
format long
%define constants
n=20;
wo= 41;
b=-1;
a=2;
c=-1;
%initialize matrix A
A = zeros(n,n);
for k = 2:n-1
A(k,k-1:k+1) = [b,a,c];
end
A(1,1:2) = [a,c];
A(n,n-1:n) = [b,a];
%adjust matrix A to initialize matrix K
K = A;
K(n,n) = 1;
%find eigenvalues and eignvectors
[V,D] = eig(K);
lambda = diag(D);
low = zeros(1,3);
low(1,1:3)=[lambda(1,1),lambda(2,1),lambda(3,1)];
freq = wo*sqrt(low);
eigvect = zeros(n,3);
eigvect(1:n,1) = V(1:n,1);
eigvect(1:n,2) = V(1:n,2);
eigvect(1:n,3) = V(1:n,3);
disp(eigvect);
figure
plot(1,eigvect(1:n,1),'og',2,eigvect(1:n,2),'ob',3,eigvect(1:n,3),'or');
xlim([0,4]);

Problem 2
function ydot = odefun(t,y)
global w0 K
n=size(K,1);
ydot = zeros(2*n,1);
z=zeros(n,1);
z(1)=1;
y1=y(1:n);
y2=y(n+1:2*n);
ydot(1:n)=y2;
ydot(n+1:2*n) = -w0^2*K*y1 + w0^2*f(t)*z;

You might also like