matlab中如何把符号多项式转换为数值多项式
来源:学生作业帮 编辑:大师作文网作业帮 分类:数学作业 时间:2024/11/10 13:42:54
matlab中如何把符号多项式转换为数值多项式
-(390625*xx*(xx - 1)*(xx + 1)*(xx - 1/5)*(xx + 1/5)*(xx - 2/5)*(xx + 2/5)*(xx - 3/5)*(xx + 3/5)*(xx - 4/5)*(xx + 4/5))/1768
是我求得的一个符号函数,如何把它转化为double类型,从而画出它的图像,(我试过str2double,但不成功),
-(390625*xx*(xx - 1)*(xx + 1)*(xx - 1/5)*(xx + 1/5)*(xx - 2/5)*(xx + 2/5)*(xx - 3/5)*(xx + 3/5)*(xx - 4/5)*(xx + 4/5))/1768
是我求得的一个符号函数,如何把它转化为double类型,从而画出它的图像,(我试过str2double,但不成功),
记该函数为f,用eval语句
完整代码如下
syms xx;
f=-(390625*xx*(xx - 1)*(xx + 1)*(xx - 1/5)*(xx + 1/5)*(xx - 2/5)*(xx + 2/5)*(xx - 3/5)*(xx + 3/5)*(xx - 4/5)*(xx + 4/5))/1768;
xx=-10:0.1:10;
plot(xx,eval(f));
完整代码如下
syms xx;
f=-(390625*xx*(xx - 1)*(xx + 1)*(xx - 1/5)*(xx + 1/5)*(xx - 2/5)*(xx + 2/5)*(xx - 3/5)*(xx + 3/5)*(xx - 4/5)*(xx + 4/5))/1768;
xx=-10:0.1:10;
plot(xx,eval(f));