107 MAE Spring 2007 HW 4 Problem 1 Contents The terms can be collected to give: The terms can be collected to give: A = [0 -7 5;0 4 7;-4 3 -7] b = [50;-30;40] x = A\b AT = A' AI = inv(A) % transpose % inverse A = 0 0 -4 -7 4 3 5 7 -7 b = 50 -30 40 x = -15.1812 -7.2464 -0.1449 AT = 0 -7 5 0 4 7 -4 3 -7 AI = -0.1775 -0.1232 -0.2500 -0.1014 0.0580 0.0725 0.1014 0 0 Published with MATLAB 7.4 MAE 107 Spring 2007 HW 4 Problem 2 Contents Function to multiply two matrices Test mat_mult for matrices from Prob 8.4 Function to multiply two matrices type mat_mult.m % function to multiply two matrices function X=mat_mult(Y,Z) if nargin < 2 disp('at least 2 input arguments required'); return end [m,n]=size(Y); [n2,p]=size(Z); if n ~= n2 disp('Inner matrix dimensions must agree.'); return end for i = 1:m for j = 1:p s=0; for k=1:n s=s+Y(i,k)*Z(k,j); end X(i,j)=s; end end end Test mat_mult for matrices from Prob 8.4 A = [6 -1;12 8;-5 4] B = [4 0;0.5 2] C = [2 -2;-3 1] mat_mult(A,B) mat_mult(A,C) mat_mult(B,C) mat_mult(C,B) mat_mult(B,A) mat_mult(C,A) A = 6 12 -5 -1 8 4 B = 4.0000 0.5000 0 2.0000 C = 2 -3 -2 1 ans = 23.5000 52.0000 -18.0000 -2.0000 16.0000 8.0000 ans = 15 0 -22 -13 -16 14 ans = 8 -5 -8 1 ans = 7.0000 -11.5000 -4.0000 2.0000 Inner matrix dimensions must agree. Inner matrix dimensions must agree. Published with MATLAB 7.3 MAE 107 Spring 2007 HW 4 Problem 3 Contents Part (a) Part (b) Part (a) The determinant can be computed as follows: D = 0*det([2 -1; -2 0]) - (-3)*det([1 -1; 5 0]) + 7*det([1 2; 5 -2]) D = -69 Part (b) Cramer's rule x1 = det([2 -3 7; 3 2 -1; 2 -2 0]) / D x2 = det([0 2 7; 1 3 -1; 5 2 0]) / D x3 = det([0 -3 2; 1 2 3; 5 -2 2]) / D x1 = 0.9855 x2 = 1.4638 x3 = 0.9130 Published with MATLAB 7.3 HW 4 Problem 3 Part (c) Pivoting is necessary, switch so first and third rows 5x1 - 2x2 = 2 x1 + 2x2 + x3 = 3 -3x2 + 7x3 = 2 Multiply pivot row 1 by 1/5 and subtract the result from the second row to eliminate the a21 term. 5x1 - 2x2 = 2 2.4x2 - x3 = 2.6 -3x2 + 7x3 = 2 Pivoting is necessary so switch the second and third row, 5x1 - 2x2 = 2 -3x2 + 7x3 = 2 2.4x2 - x3 = 2.6 Multiply pivot row 2 by 2.4/(3) and subtract the result from the third row to eliminate the a32 term. 5x1 - 2x2 = 2 -3x2 + 7x3 = 2 4.6x3 = 4.2 By back substituion, x3 = and, x2 = 1.463768, x1 = 0.985507 4.2 = 0.913043 4.6 Part (d) Substituing back in original equations, we see that they are satisfied, -3(1.463768) + 7(0.913043) = 2 0.985507 + 2(1.463768) - 0.913043 = 3 5(0.985507) - 2(1.463768) = 2 1 HW 4 Problem 4 Discretization of problem Discretizing the continuous ODE using central finite difference, 0=D Collecting terms, -(D + 0.5U x)ci-1 + (2D + kx2 )ci - (D - 0.5U x)ci+1 = 0 Assuming x = 1, and substituting parameters, -2.5ci-1 + 4.2ci - 1.5ci+1 = 0 ci+1 - 2ci + ci-1 c-+1 - ci-1 -U - kci 2 x 2x Matlab output A=[4.2 -1.5 0 0 0 0 0 0 0 -2.5 4.2 -1.5 0 0 0 0 0 0 0 -2.5 4.2 -1.5 0 0 0 0 0 0 0 -2.5 4.2 -1.5 0 0 0 0 0 0 0 -2.5 4.2 -1.5 0 0 0 0 0 0 0 -2.5 4.2 -1.5 0 0 0 0 0 0 0 -2.5 4.2 -1.5 0 0 0 0 0 0 0 -2.5 4.2 -1.5 0 0 0 0 0 0 0 -2.5 4.2] b=[200 0 0 0 0 0 0 0 30]' c=A\b A = 4.2000 -2.5000 0 0 0 0 0 0 0 -1.5000 4.2000 -2.5000 0 0 0 0 0 0 0 -1.5000 4.2000 -2.5000 0 0 0 0 0 0 0 -1.5000 4.2000 -2.5000 0 0 0 0 0 0 0 -1.5000 4.2000 -2.5000 0 0 0 0 0 0 0 -1.5000 4.2000 -2.5000 0 0 0 0 0 0 0 -1.5000 4.2000 -2.5000 0 0 0 0 0 0 0 -1.5000 4.2000 -2.5000 0 0 0 0 0 0 0 -1.5000 4.2000 b = 200 1 0 0 0 0 0 0 0 30 c = 68.6755 58.9581 50.6236 43.4825 37.3783 32.1884 27.8305 24.2779 21.5940 Plotting plot(0:10, [80 c' 20]) 2 80 70 60 50 40 30 20 0 1 2 3 4 5 6 7 8 9 10 3
Find millions of documents here - Study Guides, Homework Solutions, Papers, Exam Answer Keys and more. Course Hero has millions of course related materials that will enable you to learn better, faster and get an A in all your courses.Below is a small sample set of documents:
BoerFiveMythsMgmtAcctg1994
Path: Rhodes >> BUS >> 243 (Craig) Spring, 2008
Path: Rhodes >> RELS >> 102 (Muesse) Spring, 2008
Path: Rhodes >> RELS >> 102 (Muesse) Spring, 2008
Path: Rhodes >> RELS >> 102 (Muesse) Spring, 2008
Path: Rhodes >> RELS >> 102 (Muesse) Spring, 2008
Path: Drexel >> MATH >> 200 (Kingsberry) Spring, 2008
Path: Drexel >> CALC >> 200 (Kingsbury) Spring, 2008
Path: Drexel >> MATH >> 200 (Kingsberry) Spring, 2008
Path: Drexel >> MATH >> 200 (Kingsberry) Spring, 2008
Path: Drexel >> MATH >> 200 (Kingsberry) Spring, 2008
Path: Drexel >> MATH >> 200 (Kingsberry) Spring, 2008
Path: Drexel >> MATH >> 200 (Kingsberry) Spring, 2008
Path: Drexel >> MATH >> 200 (Kingsberry) Spring, 2008
Path: Drexel >> MATH >> 200 (Kingsberry) Spring, 2008
Path: Drexel >> PHYS >> 102 (Tyagi) Spring, 2008
Path: Drexel >> PHYS >> 102 (Tyagi) Spring, 2008
Path: Drexel >> PHYS >> 102 (Tyagi) Spring, 2008
Path: Drexel >> MATH >> 200 (Kingsberry) Spring, 2008
Path: Drexel >> MATH >> 200 (Kingsberry) Spring, 2008
Path: Drexel >> PHYS >> 102 (Tyagi) Spring, 2008
Path: Drexel >> PHYS >> 102 (Tyagi) Spring, 2008
Path: Drexel >> PHYS >> 102 (Tyagi) Spring, 2008
Path: Drexel >> PHYS >> 102 (Tyagi) Spring, 2008
Path: Drexel >> PHYS >> 102 (Tyagi) Spring, 2008
Path: Drexel >> MATH >> 200 (Kingsberry) Spring, 2008
Path: Drexel >> PHYS >> 102 (Tyagi) Spring, 2008
Path: Drexel >> CALC >> 200 (Kingsbury) Spring, 2008
Path: Drexel >> PHYS >> 102 (Tyagi) Spring, 2008
Path: Drexel >> CALC >> 200 (Kingsbury) Spring, 2008
Path: Drexel >> CALC >> 200 (Kingsbury) Spring, 2008
Path: Drexel >> MATH >> 200 (Kingsberry) Spring, 2008
Path: Drexel >> CALC >> 200 (Kingsbury) Spring, 2008
Path: Drexel >> PHYS >> 102 (Tyagi) Spring, 2008
Path: Drexel >> PHYS >> 102 (Tyagi) Spring, 2008
Path: Drexel >> MATH >> 200 (Kingsberry) Spring, 2008
Path: Drexel >> PHYS >> 102 (Tyagi) Spring, 2008
Path: Drexel >> CALC >> 200 (Kingsbury) Spring, 2008
Path: Drexel >> CALC >> 200 (Kingsbury) Spring, 2008
Path: Drexel >> CALC >> 200 (Kingsbury) Spring, 2008
Path: Drexel >> CALC >> 200 (Kingsbury) Spring, 2008
Path: Drexel >> MATH >> 200 (Jason) Spring, 2008
Path: Drexel >> MATH >> 200 (Jason) Spring, 2008
Path: Drexel >> MATH >> 200 (Jason) Spring, 2008
Path: Drexel >> MATH >> 200 (Jason) Spring, 2008
Path: Drexel >> MATH >> 200 (Jason) Spring, 2008
Path: Drexel >> MATH >> 200 (Jason) Spring, 2008
Path: Drexel >> MATH >> 200 (Jason) Spring, 2008
Path: Drexel >> MATH >> 200 (Jason) Spring, 2008
Path: Drexel >> MATH >> 200 (Jason) Spring, 2008
Path: Drexel >> MATH >> 200 (Jason) Spring, 2008
Path: Drexel >> MATH >> 200 (Jason) Spring, 2008
Path: Drexel >> MATH >> 200 (Jason) Spring, 2008
Path: Drexel >> MATH >> 200 (Jason) Spring, 2008
Path: Drexel >> MATH >> 200 (Jason) Spring, 2008
Path: Drexel >> MATH >> 200 (Jason) Spring, 2008
Path: Drexel >> MATH >> 200 (Jason) Spring, 2008
Path: Drexel >> MATH >> 200 (Jason) Spring, 2008
Path: Drexel >> MATH >> 200 (Jason) Spring, 2008
Path: Drexel >> MATH >> 200 (Jason) Spring, 2008
Path: Drexel >> MATH >> 200 (Jason) Spring, 2008
Path: Drexel >> MATH >> 200 (Jason) Spring, 2008
Path: Drexel >> MATH >> 200 (Jason) Spring, 2008
Path: Drexel >> PHYS >> 102 (Tyagi) Spring, 2008
Path: Drexel >> PHYS >> 102 (Tyagi) Spring, 2008
Path: Drexel >> PHYS >> 102 (Tyagi) Spring, 2008
Path: Drexel >> PHYS >> 102 (Tyagi) Spring, 2008
Path: Drexel >> PHYS >> 102 (Tyagi) Spring, 2008
Path: Drexel >> PHYS >> 102 (Tyagi) Spring, 2008
Path: Drexel >> PHYS >> 102 (Tyagi) Spring, 2008
Path: Drexel >> PHYS >> 102 (Tyagi) Spring, 2008
|
|
Course Hero - We put you ahead of the curve!You have requested the below document.
|
|
What People Are Saying About Course Hero
|
|||
|
|||
|
Explore the benefits of joining Course Hero's social learning network.
|
|||
![]() |
Get millions of study materials now!Need lecture notes for a missed class or want insightful explanation of the theories and concepts you learn in class? Look no further, Course Hero’s Study Materials empowers you to find a broad and deep set of materials that can help you right now!
Click below to sign-up for FREE.
|
||
![]() |
Get over 200,000 textbook solutions now!Having difficulty with your homework and need the solution so that you can accelerate your learning? Don’t be frustrated. Course Hero’s Textbook Solutions gives you solutions submitted by fellow students.
Click below to sign-up for FREE.
|
||
![]() |
Meet over 300,000 students and your fellow classmates now!Want to meet your current classmates or those that took the class last year? Don’t worry or have anxiety. Course Hero’s Study Groups gives you the seamless opportunity to develop both anonymous or direct relationships with those classmates whom you want to meet and get help from right now!
Click below to sign-up for FREE.
|
||
|
Below please find a part of the unformatted version of the requested document. Click Here to view a sample formatted document.
|
|||
|
Click below to sign-up for FREE.
|
|||


