Using "nchoosek(n,k)", create a row vector containing all the binomial coefficients for n=4 and display this vector. Repeat for n=10
조회 수: 8 (최근 30일)
이전 댓글 표시
I have tried applying "v=1:4" & then "A=nchoosek(v,3)" as well as "A=nchoosek(v,4)". However, not to sure what I'm looking for
댓글 수: 2
James Tursa
2017년 3월 23일
What have you done so far? Please make an attempt and then ask specific questions about where you are having problems with your code. Then we can help you.
James Tursa
2017년 3월 23일
편집: James Tursa
2017년 3월 23일
The instructions say that n=4, and n is the first argument in nchoosek(n,k). So I would expect that you would be using nchoosek(4,k). Then it is just a matter of what k values to use, and how to form everything into a row vector. If n=4, do you know what are all the valid values for k to get the binomial coefficients? And do you know how to form a row vector out of a bunch of numbers?
답변 (1개)
Arvind Narayanan
2017년 3월 28일
편집: Arvind Narayanan
2017년 3월 28일
According to the binomial theorem, the coefficient of every term of a polynomial (x+y)^n can be represented as
nCk*x^(n-k)*y^k
Now, I understand you want to make a row vector with the coefficients of the polynomial for n=4 and n=10 respectively. You can use something like this:
A=[];
n=4;
% n=10;
for i=0:1:n
A=[A,nchoosek(n,i)];
end
댓글 수: 1
참고 항목
카테고리
Help Center 및 File Exchange에서 Polynomials에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!