Using "nchoosek(n,k)", create a row vector containing all the binomial coefficients for n=4 and display this vector. Repeat for n=10

5 visualizaciones (últimos 30 días)
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 comentarios
James Tursa
James Tursa el 23 de Mzo. de 2017
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
James Tursa el 23 de Mzo. de 2017
Editada: James Tursa el 23 de Mzo. de 2017
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?

Iniciar sesión para comentar.

Respuestas (1)

Arvind Narayanan
Arvind Narayanan el 28 de Mzo. de 2017
Editada: Arvind Narayanan el 28 de Mzo. de 2017
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
Refer this: Binomial Theorem

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by