Create a MATLAB function that provides the binomial coeffici
Create a MATLAB function that provides the binomial coefficients for (x + y)^N = sigma_k = 0^N [N k]x^k y^N - k. In this case, the output of the function is only the N + 1 (integer) values of [N k]. %function [bin_coef] = binomial(N) % Returns the N+1 coefficients of the binomial expansion % N 2 3 N % (1+x) = [bin_coef]. * [1 x x x x ... x] Use your function to illustrate Pascal\'s Triangle by listing the binomial coefficients for N = 2, 3, ..., 10. Provide a listing of your Pascal\'s Triangle code and the results.
Solution
% some defining vertices A = [0,1]; B = [1,2]; C = [1,-1]; % collect coordinates X = [A(1), B(1), C(1)]; % x values Y = [A(2), B(2), C(2)]; % y values % compute area triangle_area = polyarea(X, Y); disp([\'The area of triangle (A,B,C) is \' num2str(triangle_area) \'.\']); % plot triangle figure(1); fill(X,Y, [0,0.4,0]);![Create a MATLAB function that provides the binomial coefficients for (x + y)^N = sigma_k = 0^N [N k]x^k y^N - k. In this case, the output of the function is on Create a MATLAB function that provides the binomial coefficients for (x + y)^N = sigma_k = 0^N [N k]x^k y^N - k. In this case, the output of the function is on](/WebImages/43/create-a-matlab-function-that-provides-the-binomial-coeffici-1132939-1761605674-0.webp)