Matlab problem, please provide help in Matlab code. The Pascal triangle can be d
ID: 3815923 • Letter: M
Question
Matlab problem, please provide help in Matlab code.
The Pascal triangle can be displayed as elements in a lower-triangular matrix where the element i j is the binomial coefficient i1 j 1 . Use the nchoosek command in this regard. Create the Pascal triangle having 7 rows
Here is a picture of the problem
The Pascal triangle can be displayed as elements in a lower-triangular matrix where the element ij is the binomial coefficient I). Use the nchoosek command in this regard. Create the Pascal triangle having 7 rows.Explanation / Answer
Matlab code:
M = zeros(7,7);
for i = 1:7
for j = 1:i
M(i,j) = nchoosek(i-1,j-1);
end
end
M
Sample Output:
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.