Economics should be open

July 20, 2009

identity matrix in excel

Filed under: Uncategorized — howardchong @ 10:13 pm

So, excel can do matrix calculations. That’s useful. But why the hell didn’t it give us a function to create an identity matrix.

Here’s a quick hack (no programming) to generate an identity matrix.

Step 1: block out the N by N matrix you want to be the identity matrix. Fill it with “x”. Easiest is to make this in a new worksheet.

Step 2: type in the formula into cell A1:

=if(row(A1)=column(A1),1,0)

Step 3: Fill this into your n x n space. CTRL-D and CTRL-R work well.

Done.

Note that for matrix inverse / inversion (MINVERSE), there is a 52×52 limit on the size of the matrix.

A link to using excel’s matrix functions I found helpful

http://www.stanford.edu/~wfsharpe/mia/mat/mia_mat4.htm

Advertisements

1 Comment »

  1. The 52×52 limit was for Office 2003. It’s higher in Office 2007.

    Comment by howardchong — March 1, 2010 @ 10:49 pm


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: