matlab - Writing sums of product taken two or three at a time -
i have variables a1 a2 a3 a4.... etc want find out f1 f2 f3 ...fk.... fn where
f1 = a1+a2+a3+a4+.....an f2 = - (sum of products of a's taken 2 @ time ) f3 = (sum of products of a's taken 3 @ time) fk = (-1)^(k+1)* (sum of products of a's taken k @ time) , on till fn
can me how fk through pseudo code or matlab code. there built-in function in matlab can me in doing ?
use in-built function poly(r) in matlab takes roots of polynomial r array:
function fk = get_comb(r,k) p=poly(r) fk=(-1)^(k)*p(k+1); end
Comments
Post a Comment