Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a Function in MATLAB function L = diagonal(A) Begin the function with the commands n=size(A,1) [P,D] = eig(A); ________________________________________________________ (Note: these two lines indicate

Create a Function in MATLAB

function L = diagonal(A)

Begin the function with the commands

n=size(A,1)

[P,D] = eig(A);

________________________________________________________

(Note: these two lines indicate that you will get n as a direct output but not [P, D].)

The command [P, D] = eig(A) produces a diagonal matrix D of eigenvalues and a full matrix P whose columns are corresponding eigenvectors so that AP=PD. Obviously, if P is invertible, its columns form a basis for R^n and A is diagonalizable. If P is not invertible, the matrix A is not diagonalizable, or equivalently, A does not have enough linearly independent eigenvectors that would form a basis for R^n . To output P, you should verify that P has exactly n linearly independent columns. Within your function diagonal, you will find the number k of linearly independent columns of P and output a message:

The number of linearly independent columns in P is k = (your value)). Comparing k with n, you should make a conclusion whether A is diagonalizable.

If A is diagonaliziable, your output has to have two messages:

(1) "A is diagonlizable".

(2) "A basis for R^n is" (output matrix P).

If A is not diagonalizable, the output has to contain two messages:

(1) "A is not diagonlizable:.

(2) "A does not have enough linearly independent eigenvectors to create a bases for R^n".

The output for the function diagonal is the vector L of all eigenvalues of A, as indicated in the heading of the function. The row vector L has to be defined within your code as L=transpose(diag(D)); and you should run the function exactly as

L=diagonal(A) to get the vector L as an output.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Upgrading Oracle Databases Oracle Database New Features

Authors: Charles Kim, Gary Gordhamer, Sean Scott

1st Edition

B0BL12WFP6, 979-8359657501

More Books

Students also viewed these Databases questions

Question

How does majority voting lead to intransitive social rankings?

Answered: 1 week ago

Question

When would you use one approach, and when would you use another?

Answered: 1 week ago