Solve MATLAB Matrix Equations & Find Eigenvalues, Vectors

  • Context: MATLAB 
  • Thread starter Thread starter sara_87
  • Start date Start date
  • Tags Tags
    Matlab Matrices
Click For Summary

Discussion Overview

The discussion revolves around solving a system of matrix equations and finding eigenvalues and eigenvectors using MATLAB. Participants explore the correct MATLAB commands for these tasks and seek clarification on their approaches.

Discussion Character

  • Homework-related
  • Technical explanation

Main Points Raised

  • Post 1 presents a system of equations and queries about the MATLAB commands to solve them, including the use of matrix inversion and eigenvalue calculations.
  • Post 1 also asks about constructing a specific matrix in MATLAB and whether to clear previous variables before starting new commands.
  • Post 2 clarifies that after using the eig function, the eigenvalues can be read directly from the diagonal of matrix D, and that the relationship A*V=V*D is relevant.
  • Post 2 corrects the use of 'fives' to '5*ones' for creating a matrix of fives.
  • Post 3 expresses uncertainty about the correctness of the approach taken in Question 3.
  • Post 4 suggests checking the edit for Question 3 for further clarification.
  • Post 5 appreciates the help received and comments on the tone of corrections made in the discussion.
  • Post 6 humorously reflects on cultural differences in communication style regarding corrections.

Areas of Agreement / Disagreement

Participants generally agree on the MATLAB commands for the tasks, but there is uncertainty regarding the correctness of the approach for Question 3. Some participants provide corrections and clarifications, but no consensus is reached on the final correctness of the solutions.

Contextual Notes

There are unresolved assumptions regarding the construction of the matrix in Question 3 and the need for clearing previous variables in MATLAB.

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
 

Similar threads

  • · Replies 32 ·
2
Replies
32
Views
4K
  • · Replies 3 ·
Replies
3
Views
5K
  • · Replies 4 ·
Replies
4
Views
2K
Replies
7
Views
2K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 5 ·
Replies
5
Views
4K
Replies
0
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 8 ·
Replies
8
Views
3K