13.1k views
2 votes
A symmetric (5 x 5) Pascal matrix is displayed on the right. Write a MATLAB program that creates an n x n symmetric Pascal matrix. Use the program to create 4 x 4 and 7 x 7 Pascal matrices. Have the value of n be a user input.

User Nyi
by
7.2k points

1 Answer

1 vote

Answer:

x = input('Enter order of pascal matrix to be formed'); // Dynamically read the order of pascal matrix to be formed

for i=1:x // loop for x number of rows

for j=1:x // loop for x number of colums

M(i,j) = factorial(i+j-2) / (factorial(i-1) * factorial(j-1)); // logic to computer the elements of matrix

end

end

M // print the matrix

User Xardas
by
7.3k points