Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Develop a user-dened function named symmetric Pascal(n) that computes values in

ID: 3564581 • Letter: D

Question

Develop a user-dened function named symmetric Pascal(n) that computes values in an nn symmetric Pascal matrix. Test your newly developed function using n = 4 and report the output when n = 10. The only MATLAB built-in function you may use is zeros() to initialize your matrix. You may not use the factorial() built-in function for this exercise. Instead, build a user-dened function userDefinedFactorial() which models factorial() and is called in symmetric Pascal(n). HINT: Inserting elements into all entries of a matrix is usually done with nested for-loops

Develop a user-dened function named symmetric Pascal(n) that computes values in an n½n symmetric Pascal matrix. Test your newly developed function using n = 4 and report the output when n = 10. The only MATLAB½ built-in function you may use is zeros() to initialize your matrix. You may not use the factorial() built-in function for this exercise. Instead, build a user-dened function userDefinedFactorial() which models factorial() and is called in symmetric Pascal(n). HINT: Inserting elements into all entries of a matrix is usually done with nested for-loops

Explanation / Answer

The elements of the symmetric Pascal matrix are obtained from: Pij = (i + j - 2)!/(j - 1)!(j - 1)! Write a MATLAB program that creates an n by n symmetric Pascal matrix. Use the program to create a 4x4 and 7x7 Pascal matrices.

for a 4x4 matrix, change the 7 in lines 1 and 2 to 4! But with this formulation, I wonder how it can be symmetric.

f = factorial(n) returns the product of all positive integers less than or equal to n, where n is a nonnegative integer value. If n is an array, then f contains the factorial of each value of n. The data type and size of f is the same as that of n.