matlab实习报告(最新)要点

1.求f(x)=4x6-x+x3-95在(0,100)上最大值、最小值,根。(使用函数fminbnd、roots)

>>[x,y]=fminbnd('4*x.^6-x+x.^3-95',0,100) x = 0.4432 y = -95.3258

>> [x,y]=fminbnd('-4*x.^6+x-x.^3+95',0,100) x = 99.9999 y =

-4.0000e+012 >> a=[4 0 0 1 0 -1 -95]; roots(a) ans =

1.6860 0.8525 + 1.4852i 0.8525 - 1.4852i -1.7050 -0.8431 + 1.4514i -0.8431 - 1.4514i

2 求解常微分方程x’’=-x’+x+1,x’(0)=1,x(0)=0(使用函数dsolve) dsolve('D2x=-Dx+x+1','Dx(0)=1','x(0)=0') ans =

(5^(1/2)*exp(t*(5^(1/2)/2 - 1/2))*(5^(1/2) + 3))/10 + (5^(1/2)*(5^(1/2) - 3))/(10*exp(t*(5^(1/2)/2 + 1/2))) - 1

3 已知t=an2+bn,测得对应数据如下:(多项式插值interp1) t=[0,20,40,60,80,100,120,140,160,183.5];

n=[0,1153,2045,2800,3466,4068,4621,5135,5619,6152]; t0=[0,20,40,60,80,100,120,140,160,183.5];

n0=[0,1153,2045,2800,3466,4068,4621,5135,5619,6152]; n=0:0.001:6152;

t=interp1(n0,t0,n,'spline'); p=polyfit(n,t,2) p =

0.0000 0.0144 0.0631 试求a和b的值。

4请用梯形法、辛普森法分别计算积分值?f=inline('sqrt(x.^2+x+1)','x'); >> quad(f,0,1) ans = 1.3369

>> x=0:0.01:1;y=sqrt(x.^2+x+1);trapz(x,y) ans = 1.3369 5计算二重积分?120010x2?x?1dx (trapz、quad)

?(x2?y2?xy?2x?y?1)dxdy (使用函数dblquad)

dblquad('x.^2+y.^2+x*y+2*x+y+1', 0, 1, 0, 2) ans = 10.3333

6矩阵M=[1,2,6; 4,2,7; 8,9,3],QR分解, 求M的LU分解,对角阵,特征值分解。

(使用函数lu、qr、shol、eig) M=[1,2,6; 4,2,7; 8,9,3]; lu(M) ans =

8.0000 9.0000 3.0000 0.5000 -2.5000 5.5000 0.1250 -0.3500 7.5500 qr(M) ans =

9.0000 9.1111 6.4444 -0.5000 2.4470 -2.3360 -1.0000 -0.4719 6.8566 [D,X]=eig(M) D =

-0.4111 -0.7719 -0.4992 -0.5484 0.6237 -0.3914 -0.7282 0.1229 0.7730 X =

14.2944 0 0 0 -1.5712 0 0 0 -6.7232

7 a=3,A=4,b=a2,B=b2-1,c=a+A-2B,C=a+B+2c,求C。(使用函数solve) >> syms a b c A B C eq1='a=3'; eq2='A=4'; eq3='b=a^2'; eq4='B=b^2-1'; eq5='c=a+A-2*B'; eq6='C=a+B+2*c';

x=solve(eq1,eq2,eq3,eq4,eq5,eq6);

联系客服:779662525#qq.com(#替换为@) 苏ICP备20003344号-4