Re: Unit matrix?



desktop wrote:
How do I make a 4x4 unit matrix in matlab:

1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1

I have tried:

ones(4,4)

but that fills 1 in every position.

eye(4) did the job.
.