Codigos Matlab

Páginas: 4 (823 palabras) Publicado: 5 de octubre de 2012
Expressions: + (addition) - (substrction) * (multiplication) / (division) \ (left division of matrix)
^ (power) ‘ (complex conjugate transpose)
help elfun % list all elementary math functions
helpspecfun % list specific math functions
help elmat % list matrix functions
v = [1, 3, 5] % define vector v and print output
e=[0.1 0.2 0.4 0.6 0.8]; % define vector e but no print out
x = 0: 2: 8;% Generate vectors x giving [ 0 2 4 6 8]
x = linspace(a,b,n) % returns a vector with n elements in the interval [a,b]
x = logspace(a,b,n) % returns a vector with n elements in the interval[10a,10b]A = [1 2 3; 4 5 6; 7 8 9] % generates a matrix by input
If an ASCII-file A.dat is created by an editor and has in it:
1 4 5
4 2 9
load A.dat A % load the file into matrix A
save B.dat A % savesthe matrix A into file B.dat
A, B, C, D are matrices
A=eye (3) % generate a 3x3 Identity Matrix
B=zeros(2,4) % generate a 2x4 Zero matrix
C=ones(3,2) % generate a 3x2 matrix with one assigned toall elements
A’ % gives the Transpose of matrix A
A(1,3) % gives the (1,3) element of matrix A
V=A(1:4,2) % takes the elements (1,2),(2,2),(3,2),(4,2) from matrix A to form vector V
V=A(:,3) %takes the column 3 of matrix A to form vector V
V=A(:,end) % takes the last column of matrix A to form vector V
D=[A C] % concatenate matrix A & C (append the columns of C to the columns of A)D=[A;C-2] % subtract 2 from each element of C and append it as the bottom rows of A
D=[A C; A-2 C] % concatenate to form new matrix
D(:,2) = [] % delete the second column of matrix D
sum(A) % gives thesum of each column of matrix A
diag(A) % gives the diagonal of matrix A
det(A) % return the determinant of matrix A
inv(A) % return the inverse of matrix A
eig(A) % return the eigen values of matrixA
poly(A) % returns the coefficients of the characteristic polynomial det(A-λI)
A*B % multiply matrix A by matrix B
A.*B % (i,j) element of the product matrix is A(i,j)*B(i,j)
A./B % (i,j)...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Codigos matlab
  • Codigo Para La Transformada De Fourier Matlab
  • Matlab codigos
  • Mediciones de tiempo de reververacion en una sala codigo Matlab
  • Codigo miller en matlab
  • Codigo de metodos numericos en matlab
  • CODIGOS METODOS NUMERICOS PARA MATLAB
  • codigo en matlab para rampa unitaria

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS