简体   繁体   English

如何使用系数向量和符号变量向量创建符号多项式?

[英]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). 与多项式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 我的问题是,如何使用MATLAB创建符号矢量?

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 ? 并打印出来,我得到表达式1 + 2z + 3z^2的1x1“矩阵”?

Furthermore, how can I generalize the creation of p to extend for arbitrary powers z^3, z^4, ...? 此外,我如何概括p的创建以扩展到任意幂z ^ 3,z ^ 4,...?

Thanks! 谢谢!

p = z.^(0:2);

In general: 一般来说:

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

where n equals number of elements. 其中n等于元素数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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