Главная

Популярная публикация

Научная публикация

Случайная публикация

Обратная связь

ТОР 5 статей:

Методические подходы к анализу финансового состояния предприятия

Проблема периодизации русской литературы ХХ века. Краткая характеристика второй половины ХХ века

Ценовые и неценовые факторы

Характеристика шлифовальных кругов и ее маркировка

Служебные части речи. Предлог. Союз. Частицы

КАТЕГОРИИ:






Обратное (левое) деление. Решение систем линейных уравнений




>> A=[2 3 -1; 3 4 -3; 2 0 5]; B=[3; 1; 8];

>> X=A\B X = -0.3333

1.8000

1.7333

Diff

Differences and approximate derivatives

Syntax

Y = diff(X)

Y = diff(X,n)

Y = diff(X,n,dim)

Description

Y = diff(X) calculates differences between adjacent elements of X.

If X is a vector, then diff(X) returns a vector, one element shorter than X, of differences between adjacent elements:

[X(2)-X(1) X(3)-X(2)... X(n)-X(n-1)]

If X is a matrix, then diff(X) returns a matrix of row differences:

[X(2:m,:)-X(1:m-1,:)]

In general, diff(X) returns the differences calculated along the first non-singleton (size(X,dim) > 1) dimension of X.

Y = diff(X,n) applies diff recursively n times, resulting in the nth difference. Thus, diff(X,2) is the same as diff(diff(X)).

Y = diff(X,n,dim) is the nth difference function calculated along the dimension specified by scalar dim. If order n equals or exceeds the length of dimension dim, diff returns an empty array.

Remarks

Since each iteration of diff reduces the length of X along dimension dim, it is possible to specify an order n sufficiently high to reduce dim to a singleton (size(X,dim) = 1) dimension. When this happens, diff continues calculating along the next nonsingleton dimension.

Examples

The quantity diff(y)./diff(x) is an approximate derivative.

x = [1 2 3 4 5];

y = diff(x)

y = 1 1 1 1

z = diff(x,2)

z = 0 0 0

Given, A = rand(1,3,2,4);

diff(A) is the first-order difference along dimension 2.

diff(A,3,4) is the third-order difference along dimension 4.

 

Еще есть функции:

 

hess Hessenberg form of matrix

schur Schur decomposition

qz QZ factorization for generalized eigenvalues

triu Upper triangular part of matrix

tril Lower triangular part of matrix

spdiags Extract and create sparse band and diagonal matrices

full Convert sparse matrix to full matrix

bsxfun Apply element-by-element binary operation to two arrays with singleton expansion enabled

arrayfun Apply function to each element of array

spfun Apply function to nonzero sparse matrix elements

spy Visualize sparsity pattern

gplot Plot nodes and links representing adjacency matrix (матрицу смежности) - построение графа

qr Orthogonal-triangular decomposition

null Null space

orth Range space of matrix

symamd Symmetric approximate minimum degree permutation

chol Cholesky factorization

sprand Sparse uniformly distributed random matrix

nnz Number of nonzero matrix elements

и др.






Не нашли, что искали? Воспользуйтесь поиском:

vikidalka.ru - 2015-2024 год. Все права принадлежат их авторам! Нарушение авторских прав | Нарушение персональных данных