MATLAB Answers

Pritesh Shah

Magic and Trace Function

Asked by Pritesh Shah
on 14 Sep 2012

Hi, I was amaze to see following output: >> A=[2 3; 4 5]

A =

     2     3
     4     5

>> trace(A)

ans =

     7

>> trace A

ans =

    65

Que: Why am I getting answer of trace A as 65??

(ASCI Value of A is 65)

  0 Comments

Products

1 Answer

Answer by Wayne King
on 14 Sep 2012
Edited by Wayne King
on 14 Sep 2012
 Accepted answer

That's because the functional form you are using when you enter

 >>trace A

is executing

>>trace('A')

and in this case, it is nothing more than

>>sum('A')

Just like

>>help conv

is the same as

>>help('conv')

  0 Comments


Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply today