This MATLAB Function is TRICKY 🙀

Опубликовано: 05 Март 2025
на канале: Laplace Academy
798
25

Hello. welcome to Laplace Academy.
In this #short tutorial I'm going to introduce this MATLAB function: diag.
diag is the abbreviated form of diagonal matrix.

So to create a diagonal matrix out of a vector, just use diag function.

Also, you can extract the diagonal elements of a matrix using this command, diag(M).
It returns the diagonal elements in a column vector.
You can convert it into a row vector by transposing it. diag(M)'