Prev: Simple 3d Plot
Next: color a 3D line
From: Nick Todd on 23 May 2010 21:50 Walter Roberson <roberson(a)hushmail.com> wrote in message <8TbKn.30272$wV2.27818(a)newsfe23.iad>... > Nick Todd wrote: > > I need to be able to represent a symbolic expression such as y = a^5*X^3 > > + X + 1 , where the X^2 term is not present, as a vector ie. [a^5 0 1 1] > > > > I cannot use sym2poly because the expression contains more than one > > symbolic variable. The coeffs function seems appropriate but doesn't > > include the zero coefficient of X^2 ie returns [a^5, 1, 1]. > > > > How can I get a coefficient vector which contains any zero coefficients > > that might be present in the symbolic representation? > > See > http://www.mathworks.com/matlabcentral/newsreader/view_thread/276491#730341 > "Extract numbers (coefficients) from a polynomial (sym)" Thanks Walter, do you know how i can do this using matlab code only? I'm thinking i could build the vector manually from the two output version of coeffs but i need to know the power attached to each X term present. Is there a function to find the degree of a symbolic expression?
From: Walter Roberson on 23 May 2010 22:34 Nick Todd wrote: > Walter Roberson <roberson(a)hushmail.com> wrote in message > <8TbKn.30272$wV2.27818(a)newsfe23.iad>... >> Nick Todd wrote: >> > I need to be able to represent a symbolic expression such as y = >> a^5*X^3 > + X + 1 , where the X^2 term is not present, as a vector ie. >> [a^5 0 1 1] >> See >> http://www.mathworks.com/matlabcentral/newsreader/view_thread/276491#730341 > do you know how i can do this using matlab code only? I think you will have to use some MuPad. Matlab itself does not provide tools to analyze symbolic expressions. > I'm thinking i could build the vector manually from the two output > version of coeffs but i need to know the power attached to each X term > present. Is there a function to find the degree of a symbolic expression? degree() http://www.mathworks.com/access/helpdesk/help/toolbox/mupad/stdlib/degree.html You may wish to consider just filling in the holes after using poly2list() http://www.mathworks.com/access/helpdesk/help/toolbox/mupad/stdlib/poly2list.html
|
Pages: 1 Prev: Simple 3d Plot Next: color a 3D line |