- #1

- 763

- 0

## Main Question or Discussion Point

**Question 1:**

Solve the system of equations

-w + 3x - 2y + z = 1

w + 2x - 4y - 3z = 2

x + 2y + z = 4

2w + 3x - y - z = 7

**The attempt at a solution**

To do this in matlab, this is what I will did:

>> A=[-1,3,-2,1;1,2,-4,-3;0,1,2,1;2,3,-1,-1]; b = [1;2;4;7]

>>x=inv(A)*b

Then matlab should give an answer with the solutions of w, x, y and z written in a separate line…no?

**Question 2:**

Find the eigenvalues and eigenvectors of the matrix

3, -1, 0, 0

-1, 5, -2, 0

0, -2, 6, -1

0, 0, -1, 2

**The attempt at a solution**

In matlab do I do this:

>>A=[3,-1,0,0;-1,5,-2,0;0,-2,6,-1;0,0,-1,2] ;

>>[V,D]=eig(A)

Then I should get an answer for V and D, and v is a matrix whose columns are the eigenvectors and D is the diagonal matrix, so we multiply the first column of V with the first diagonal of D etc… am I wrong?

**Question 3:**

Let

A=

-3, 4, 2, 0

1, -2, 0, 1

-4, 5, 0, 3

0, 1, -4, 2

Write the Matlab commands to construct the following matrix:

3, 0, 0, 0, -3, 1, -4, 0

0, 4, 0, 0, 4, -2, 5, 1

0, 0, 5, 0, 2, 0, 0, -4

0, 0, 0, 6, 0, 1, 3, 2

-3, 4, 2, 0, 5, 5, 5, 5

1, -2, 0, 1, 5, 5, 5, 5

-4, 5, 0, 3, 5, 5, 5, 5

0, 1, -4, 2, 5, 5, 5, 5

**The attempt at a solution**

In matlab should i do this:

>>A=[-3,4,2,0;1,-2,0,1;-4,5,0,3;0,1,-4,2]

Then to construct the other big matrix do I do this:

>> B=[diag(3:6),A’;A, fives(4,4)]

You’ve probably all figured that I don’t have access to matlab just now, so I would be grateful if someone who has access to matlab could just copy and paste the commands in to see if it works.

Also between each question do I write clear all to clear everything before I start the question?

Last edited: