P = pascal( returns the lower
triangular Cholesky factor (up to the signs of the columns) of the Pascal matrix.
P is involutary, that is, it is its own
P = pascal( returns a transposed and
permuted version of
pascal(n,1). In this case,
P is a cube root of the identity matrix.
P = pascal(___,
returns a matrix of class
classname using any of the input
argument combinations in previous syntaxes.
classname can be
Matrix from Pascal's Triangle
Compute the fourth-order Pascal matrix.
A = pascal(4)
A = 4×4 1 1 1 1 1 2 3 4 1 3 6 10 1 4 10 20
Compute the lower triangular Cholesky factor of the third-order Pascal matrix, and verify it is involutory.
A = pascal(3,1)
A = 3×3 1 0 0 1 -1 0 1 -2 1
ans = 3×3 1 0 0 1 -1 0 1 -2 1
n — Matrix order
scalar, nonnegative integer
Matrix order, specified as a scalar, nonnegative integer.
classname — Matrix class
'double' (default) |
Matrix class, specified as either
Pascal’s triangle is a triangle formed by rows of numbers. The first row has entry
1. Each succeeding row is formed by adding adjacent entries
of the previous row, substituting a
0 where no adjacent entry
pascal function forms Pascal’s matrix by selecting
the portion of Pascal’s triangle that corresponds to the specified matrix
dimensions, as outlined in the graphic. The matrix outlined corresponds to the
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Run code in the background using MATLAB®
backgroundPool or accelerate code with Parallel Computing Toolbox™
This function fully supports thread-based environments. For more information, see Run MATLAB Functions in Thread-Based Environment.