Using "nchoosek(n,k)", create a row vector containing all the binomial coefficients for n=4 and display this vector. Repeat for n=10
11 ビュー (過去 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!