at=b matrix form in matlab

To create a matrix in MATLAB, you can use the following syntax:

main.m
A = [1 2 3; 4 5 6; 7 8 9];
27 chars
2 lines

This creates a 3x3 matrix A, where each row is separated by a semicolon and each element within a row is separated by a space. You can adjust the dimensions of the matrix by changing the number of rows and columns.

To add two matrices, you can use the + operator. For example:

main.m
B = [2 3 4; 5 6 7; 8 9 10];
C = A + B;
39 chars
3 lines

This creates a matrix C that is the element-wise sum of matrices A and B. Similarly, you can subtract matrices using the - operator, multiply matrices using the * operator, and find the transpose of a matrix using the ' operator.

main.m
D = A - B;
E = A * B;
F = A';
30 chars
4 lines

gistlibby LogSnag