MATLAB Solve MATLAB Matrix Equations & Find Eigenvalues, Vectors

  • Thread starter Thread starter sara_87
  • Start date Start date
  • Tags Tags
    Matlab Matrices
AI Thread Summary
The discussion focuses on solving a system of matrix equations and finding eigenvalues and eigenvectors using MATLAB. For the first question, the user correctly sets up the matrix and vector but seeks confirmation on the output format. In the second question, the user outlines the method to find eigenvalues and eigenvectors, correctly identifying the output matrices. The third question involves constructing a specific matrix, where the user is advised to use the correct MATLAB function for creating a matrix of fives. Overall, the participants provide constructive feedback on MATLAB commands and clarify misunderstandings regarding matrix operations.
sara_87
Messages
748
Reaction score
0
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 into see if it works.

Also between each question do I write clear all to clear everything before I start the question?
 
Last edited:
Physics news on Phys.org
For question 2, you don't have to do anything after eig.

D is a diagonal matrix of eigenvalues - just read them off the diagonal, and V is the corresponding matrix of eigenvectors - just take each column separately.

(You also have the relationship A*V=V*D - this is what you may be thinking when you want to multiply...?)

Qu 3 is right but for, there is no such thing as fives: use 5*ones(4,4).

Qu 1 looks good too.
 
Last edited:
ok thanx
do you know if i did Question 3 right coz i have a feeling it is wrong?
 
See edit above for Qu3.
 
ok thanks i really appreciate your help!

and you didn't have to say 'there is no such thing' just correct me lol
 
sara_87 said:
and you didn't have to say 'there is no such thing' just correct me lol
That's my new found Dutch abruptness invading my English politeness :-p
 
Back
Top