中国高校课件下载中心 》 教学资源 》 大学文库

厦门大学数学科学学院:《高等代数》课程教学资源(应用与实验)Key to MATLAB Ex 6 - Polynomial

文档信息
资源类别:文库
文档格式:PDF
文档页数:5
文件大小:108.5KB
团购合买:点击进入团购
内容简介
厦门大学数学科学学院:《高等代数》课程教学资源(应用与实验)Key to MATLAB Ex 6 - Polynomial
刷新页面文档预览

KeytoMatlabExercise6SchoolofMathematicalSciencesXiamenUniversityhttp:/gdjpkc.xmu.edr Key to MATLAB Exercise 6-Polynomial a=[10003-4 >>a2=[1000 0 0 >r[01-3; poly(r) ans >>a=1-2;-3-4;poly(a) 3-10 >> a=1 23; poly(a ans >> syms x;f=(x-1)*(x-2)(X-3) f (x-1)*(x-2)*(x-3) >horner(f) (x-1)*(x-2)*(x-3) >>subs(f, 4 ans >subs(f,1:10) 062460120210336504 Ex

Key to MATLAB Exercise 6  School of Mathematical Sciences Xiamen University  http://gdjpkc.xmu.edu.cn  Key to Ex6­1  Key to MATLAB Exercise 6 – Polynomial  1.  1) >> a=[1 0 0 0 3 ­4] a =  1  0  0  0  3  ­4  2) >> a2=[1 0 0 0] a2 =  1  0  0  0  3) >> r=[0 1 ­3]; poly(r) ans =  1  2  ­3  0  4) >> a=[1 ­2; ­3 ­4]; poly(a) ans =  1  3  ­10  2.  1) >> a=[1 2 3]; poly(a) ans =  1  ­6  11  ­6  2) >> syms x; f=(x­1)*(x­2)*(x­3) f =  (x­1)*(x­2)*(x­3) 3) >> pretty(f) (x ­ 1) (x ­ 2) (x ­ 3) 4) >> horner(f) ans =  (x­1)*(x­2)*(x­3) 3.  1) >> subs(f, 4) ans =  6  2) >> subs(f, 1:10)  ans =  0  0  0  6  24  60  120 210  336  504

Key to MATLAB Exercise 6 School of Mathematical Sciences Xiamen Univer http:/edjpkc.xmu.ed syms x, mat=eye(2); sym pol a=x2+1; subs(sym pol a, mat) ans Let mat t12 It generate a matrix, the(i,)) element of which is obtained by substituting 2122 2+1+1_(12+102+1 the x in x+I with the (i, )element of mat, that is,21+1 22+10+1 12+1 >>clear; mat=eye(2); pol a=[10 1; polyvalm(pol a, mat) ans 02 The answer is the result of 01 > syms x; mat =eye(2): pol a=x2+1; polyvalm(pol a, mat) ??? Inputs to polyvalm must be floats, namely single or double Error in==> polyvalm at 27 Y=diag(p(1)*ones(m, I, superiorfloat(p, X))) 02 2+x-4:g=2*x^2+1:fpl f plus_g sym 3*x^2+x-3 > clear; f0=[11-4: g0=20 1; f plus g vector=f0+g0 in vector form f plus g vector= > clear; f0=[l 1-4: g0=20]; f plus g sym=poly 2sym(f0)+poly2sym(g0) 3*x^2+x-3 2) >clear; syms x; fx2+x-4: g=2*x2+1; f multiply g sym=fg

Key to MATLAB Exercise 6  School of Mathematical Sciences Xiamen University  http://gdjpkc.xmu.edu.cn  Key to Ex6­2  4.  1) >> syms x; mat = eye (2); sym_pol_a = x^2+1; subs(sym_pol_a, mat)  ans =  2  1  1  2  Let  11 12  21 22 t t mat t t Ê ˆ = Á ˜ Ë ¯ , It generate a matrix, the (i, j) element of which is obtained by substituting  the x in  2 x +1 with the (i, j) element of mat, that is,  2 2 2 2  11 12  2 2 2 2  21 22  1 1 1 1 0 1 .  1 1 0 1 1 1 t t t t Ê + + ˆ Ê + + ˆ Á ˜ = Á ˜ + + + + Ë ¯ Ë ¯ 2) >> clear; mat = eye (2); pol_a = [1 0 1]; polyvalm(pol_a, mat)  ans =  2  0  0  2  The answer is the result of 2  1 0 1 0  0 1 0 1 Ê ˆ Ê ˆ Á ˜ + Á ˜ Ë ¯ Ë ¯ .  3) >> syms x; mat = eye (2); pol_a =x^2+1; polyvalm(pol_a, mat)  ??? Inputs to polyvalm must be floats, namely single or double.  Error in ==> polyvalm at 27  Y = diag(p(1) * ones(m,1,superiorfloat(p,X)));  >> clear;syms x; mat = eye (2); pol_a =x^2+1; polyvalm(sym2poly(pol_a), mat)  ans =  2  0  0  2  5.  1) >> clear; syms x; f=x^2+x­4; g=2*x^2+1; f_plus_g_sym=f+g  % in sym form  f_plus_g_sym =  3*x^2+x­3  Or >> clear; f0=[1 1 ­4]; g0=[2 0 1]; f_plus_g_vector=f0+g0  % in vector form  f_plus_g_vector =  3  1  ­3  Or >> clear; f0=[1 1 ­4]; g0=[2 0 1]; f_plus_g_sym=poly2sym(f0)+poly2sym(g0) f_plus_g_sym =  3*x^2+x­3  2) >> clear; syms x; f=x^2+x­4; g=2*x^2+1; f_multiply_g_sym=f*g

Key to MATLAB Exercise 6 School of Mathematical Sciences Xiamen Univer http:/edjpkc.xmu.ed f multiply g sym (x^2+x-4)°(2*x^2+1 s> collect(f multiply g sym) ans 2*x^4+2*x^3-7*x^2+x4 > clear; f0=[1 1-4:g0=20 1; f multiply g vector-conv(f0, go) f multiply g vector 2 > poly 2sym(f multiply g vector) ans 2*x^4-7*x^2+2*x^3+x4 >> clear; syms x; f-x2+x-4: g=2*x2+1; subs(f, g) ans (2*x^2+1)2+2*x^2-3 clear; 0[1 1-4; g0=[20 1]; [q, r]=decon(f0, g0 0.5000 0 > clear; syms x, fx2:g=3x5+l; f plus g sym=f+g f pl x^2+3*x^5+1 >clear; f0=10001001: g0=300001; f plus g vectorf0+g0 >>f plus g sym=poly2sym(f plus g vector) f plus g sym= x^2+3*x^5+1 s>clear; syms x; fx2: g3x 5+1; f multiply g sym=fg f multiply g sym poly2sym(sym2 poly(f multiply g sym)) ans 3*x^7+x^2 > clear; f0=1000100; g0=300001; f multiply g vector=conv(f0, g0) f multiply g vector

Key to MATLAB Exercise 6  School of Mathematical Sciences Xiamen University  http://gdjpkc.xmu.edu.cn  Key to Ex6­3  f_multiply_g_sym =  (x^2+x­4)*(2*x^2+1) >> collect(f_multiply_g_sym) ans =  2*x^4+2*x^3­7*x^2+x­4  Or >> clear; f0=[1 1 ­4]; g0=[2 0 1]; f_multiply_g_vector=conv(f0, g0) f_multiply_g_vector =  2  2  ­7  1  ­4  >> poly2sym(f_multiply_g_vector) ans =  2*x^4­7*x^2+2*x^3+x­4  3) >> clear; syms x; f=x^2+x­4; g=2*x^2+1; subs(f, g) ans =  (2*x^2+1)^2+2*x^2­3  4) >> clear; f0=[1 1 ­4]; g0=[2 0 1]; [q, r]=deconv(f0, g0) q =  0.5000  r =  0  1.0000  ­4.5000  6.  1) >> clear; syms x; f=x^2; g=3*x^5+1; f_plus_g_sym=f+g  f_plus_g_sym =  x^2+3*x^5+1  Or >> clear; f0=[0 0 0 1 0 0]; g0=[3 0 0 0 0 1]; f_plus_g_vector=f0+g0  f_plus_g_vector =  3  0  0  1  0  1  >> f_plus_g_sym =poly2sym(f_plus_g_vector) f_plus_g_sym =  x^2+3*x^5+1  2) >> clear; syms x; f=x^2; g=3*x^5+1; f_multiply_g_sym=f*g  f_multiply_g_sym =  x^2*(3*x^5+1) >> poly2sym(sym2poly(f_multiply_g_sym)) ans =  3*x^7+x^2  Or >> clear; f0=[0 0 0 1 0 0]; g0=[3 0 0 0 0 1]; f_multiply_g_vector=conv(f0, g0) f_multiply_g_vector =

KeytoMatlabexErcise6SchoolofMathematicalSciencesXiamenUniversityhttpgdjpkc.xmuedu.cr 00 0 00 0 >f multiply g sym=poly 2sym(f multiply g vector) f multiply g sym 3*x^7+x^2 7. for example 6.2) > clear; syms x; f-x 2: g=3 x5+1; f multiply g sym=f g f multiply_g sym x^2*(3*x^5+1) s> collect(f multiply g sym) 3*x^7+x^2 clear;f0=0001001g0-=]; f multiply_g vector=conv(f0, g0) f multiply g vector= >>f multiply_g sym-poly2sym(f multiply g vector f multiply 3*x^7+x^2 2) > clear; syms x; fx2: g=3* 5+1; f multiply g sym=fg f multiply_g sym x^2°(3*x^5+1) sym2poly(f multiply g sym 1) >> A=diag(1: 3), Pfix(10*rand(3)); B-=p*A*p B= 71135175 171175329 >>B=B 11 > roots(poly (B)) 513.6451 494764 0.8785

Key to MATLAB Exercise 6  School of Mathematical Sciences Xiamen University  http://gdjpkc.xmu.edu.cn  Key to Ex6­4  0  0  0  3  0  0  0 0  1  0  0  >> f_multiply_g_sym =poly2sym(f_multiply_g_vector) f_multiply_g_sym =  3*x^7+x^2  7.  for example 6.2) 1) >> clear; syms x; f=x^2; g=3*x^5+1; f_multiply_g_sym=f*g  f_multiply_g_sym =  x^2*(3*x^5+1) >> collect(f_multiply_g_sym) ans =  3*x^7+x^2  Or clear; f0=[0 0 0 1 0 0]; g0=[3 0 0 0 0 1]; f_multiply_g_vector=conv(f0, g0) f_multiply_g_vector =  0  0  0  3  0  0  0 0  1  0  0  >> f_multiply_g_sym =poly2sym(f_multiply_g_vector) f_multiply_g_sym =  3*x^7+x^2  2) >> clear; syms x; f=x^2; g=3*x^5+1; f_multiply_g_sym=f*g  f_multiply_g_sym =  x^2*(3*x^5+1) >> sym2poly(f_multiply_g_sym) ans =  3  0  0  0  0  1  0 0  8.  1) >> A=diag(1:3); p=fix(10*rand(3)); B=p'*A*p;  B =  100  71  171  71  135  175  171  175  329  >> B==B'  ans =  1  1  1  1  1  1  1  1  1  >> roots(poly(B)) ans =  513.6451  49.4764  0.8785  2)

Key to matlaB Exercise 6 School of Mathematical Sciences Xiamen University h http:/edjpkc.xmu.ed >A0=diag(0: 2): P=fix(10 rand(3); B0-p"A'p B 14415244 15216450 5017 >B=B roots(poly(B)) ans 320.9116 4.0884 0.0000 >>f[12-3-1-23l;g=[11-5-60; >>[qrldeconv(f g) 3 > poly2sym(g) poly2sym(r) x^3+10*x^2+4*x+3 10. Omitted

Key to MATLAB Exercise 6  School of Mathematical Sciences Xiamen University  http://gdjpkc.xmu.edu.cn  Key to Ex6­5  >> A0=diag(0:2); p=fix(10*rand(3)); B0=p'*A*p;  B =  144  152  44  152  164  50  44  50  17  >> B==B'  ans =  1  1  1  1  1  1  1  1  1  >> roots(poly(B)) ans =  320.9116  4.0884  0.0000  9.  >> f=[1 2 ­3 ­1 ­2 3]; g=[1 1 ­5 ­6 0];  >> [q,r]=deconv(f,g) q =  1  1  r =  0  0  1  10  4  3  >> poly2sym(q) ans =  1+x  >> poly2sym(r) ans =  x^3+10*x^2+4*x+3  10.  Omitted

已到末页,全文结束
刷新页面下载完整文档
VIP每日下载上限内不扣除下载券和下载次数;
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
相关文档