简体   繁体   中英

How to create symbolic polynomial using coefficient vector and symbolic variable vector?

I have a coefficient column vector looking something like

x = [1 2 3]'

that aligns with the polynomial p(z) = x_0 + x_1*z + x_2*z^2 + ... + x_n-1*z^(n-1). My question is, how would one create a symbolic vector using MATLAB, something like

p = [1 z z^2]

so that when I take the matrix product

p*x

and print it I get a 1x1 "matrix" of the expression 1 + 2z + 3z^2 ?

Furthermore, how can I generalize the creation of p to extend for arbitrary powers z^3, z^4, ...?

Thanks!

p = z.^(0:2);

In general:

p = z.^(0:n-1);

where n equals number of elements.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM