Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Polynomial expansion
Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  
Mustafa Fanaswala

Posts: 11
Registered: 11/5/07
Polynomial expansion
Posted: Nov 5, 2007 8:37 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hi, I'm currently hard coding this but I was wondering if
somebody could help me with writing a function for the
polynomial expansion of a vector. For example if I have a
vector [x1 x2] and I want a 2nd order polynomial expansion
then my expanded vector z= [1 x1 x2 x1^2 x1x2 x2^2] which is
all the possible cross terms and powers of x1 and x2. As
another example, if I wanted a second order expansion of [x1
x2 x3] then z=[1 x1 x2 x3 x1x2 x2x3 x1x3 x1^2 x2^2 x3^2].
Finally, if I needed a third order expansion of [x1 x2], then
z=[1 x1 x2 x1^2 x1x2 x2^2 x1^2x2 x1x2^2 x1^3 x2^3]

Can some one help me formulate this in the form of a function?



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.