Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
determinant of a matrix of functions

Subject: determinant of a matrix of functions

From: Mohsen Rajaei

Date: 6 Oct, 2013 13:51:11

Message: 1 of 3

Dear all,

I have a 2-by-2 matrix and want to get the determinant. This is easy when the elements are numbers. For example, when we have
A=[1 2 ; 3 4]
det(A) returns -2.

But if I have a matrix of functions, for example
A=@(x) [x x+1 ; x+2 x],
I expect that det(A) returns a function which is -3*x-2; however, MATLAB cannot evaluate this and returns this error:

Undefined function 'det' for input arguments of type 'function_handle'.

How can I find the determinant of this matrix? Is there another way to solve this problem??

Best Regards
M. Rajaei

Subject: determinant of a matrix of functions

From: Bruno Luong

Date: 7 Oct, 2013 06:28:05

Message: 2 of 3

"Mohsen Rajaei" <mrajaei87@gmail.com> wrote in message <l2rpsf$lrd$1@newscl01ah.mathworks.com>...
> Dear all,
>
> I have a 2-by-2 matrix and want to get the determinant. This is easy when the elements are numbers. For example, when we have
> A=[1 2 ; 3 4]
> det(A) returns -2.
>
> But if I have a matrix of functions, for example
> A=@(x) [x x+1 ; x+2 x],
> I expect that det(A) returns a function which is -3*x-2; however, MATLAB cannot evaluate this and returns this error:
>
> Undefined function 'det' for input arguments of type 'function_handle'.
>
> How can I find the determinant of this matrix? Is there another way to solve this problem??

@d det(A(x))

Subject: determinant of a matrix of functions

From: Steven Lord

Date: 7 Oct, 2013 14:16:55

Message: 3 of 3


"Mohsen Rajaei" <mrajaei87@gmail.com> wrote in message
news:l2rpsf$lrd$1@newscl01ah.mathworks.com...
> Dear all,
>
> I have a 2-by-2 matrix and want to get the determinant. This is easy when
> the elements are numbers. For example, when we have
> A=[1 2 ; 3 4]
> det(A) returns -2.
>
> But if I have a matrix of functions, for example
> A=@(x) [x x+1 ; x+2 x],
> I expect that det(A) returns a function which is -3*x-2; however, MATLAB
> cannot evaluate this and returns this error:
>
> Undefined function 'det' for input arguments of type 'function_handle'.
>
> How can I find the determinant of this matrix? Is there another way to
> solve this problem??

If you have Symbolic Math Toolbox:

syms x
A = [x, x+1; x+2, x]
det(A)

If you're doing this to try to determine the eigenvalues of the matrix, use
the EIG function instead. Also note that if your A matrix is large and/or
complicated, the expression you'll receive may be quite large and
complicated as well.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us