MATLAB程序设计与应用 实验答案 第六章 刘卫国.docx

上传人:b****8 文档编号:23732455 上传时间:2023-05-20 格式:DOCX 页数:152 大小:91.88KB
下载 相关 举报
MATLAB程序设计与应用 实验答案 第六章 刘卫国.docx_第1页
第1页 / 共152页
MATLAB程序设计与应用 实验答案 第六章 刘卫国.docx_第2页
第2页 / 共152页
MATLAB程序设计与应用 实验答案 第六章 刘卫国.docx_第3页
第3页 / 共152页
MATLAB程序设计与应用 实验答案 第六章 刘卫国.docx_第4页
第4页 / 共152页
MATLAB程序设计与应用 实验答案 第六章 刘卫国.docx_第5页
第5页 / 共152页
点击查看更多>>
下载资源
资源描述

MATLAB程序设计与应用 实验答案 第六章 刘卫国.docx

《MATLAB程序设计与应用 实验答案 第六章 刘卫国.docx》由会员分享,可在线阅读,更多相关《MATLAB程序设计与应用 实验答案 第六章 刘卫国.docx(152页珍藏版)》请在冰豆网上搜索。

MATLAB程序设计与应用 实验答案 第六章 刘卫国.docx

MATLAB程序设计与应用实验答案第六章刘卫国

1.

(1)

A=randn(10,5)

A=

-0.4326-0.18670.2944-0.3999-1.6041

-1.66560.7258-1.33620.69000.2573

0.1253-0.58830.71430.8156-1.0565

0.28772.18321.62360.71191.4151

-1.1465-0.1364-0.69181.2902-0.8051

1.19090.11390.85800.66860.5287

1.18921.06681.25401.19080.2193

-0.03760.0593-1.5937-1.2025-0.9219

0.3273-0.0956-1.4410-0.0198-2.1707

0.1746-0.83230.5711-0.1567-0.0592

B=mean(A)

B=

0.00130.23100.02530.3588-0.4197

C=std(A)

C=

0.90340.88291.18980.78321.0821

(2)

D=max(max(A))

D=

2.1832

E=min(min(A))

E=

-2.1707

(3)

F=sum(A,2)

F=

-2.3288

-1.3287

0.0105

6.2215

-1.4895

3.3602

4.9201

-3.6964

-3.3998

-0.3025

G=sum(sum(A))

G=

1.9666

(4)

H=sort(A)

H=

-1.6656-0.8323-1.5937-1.2025-2.1707

-1.1465-0.5883-1.4410-0.3999-1.6041

-0.4326-0.1867-1.3362-0.1567-1.0565

-0.0376-0.1364-0.6918-0.0198-0.9219

0.1253-0.09560.29440.6686-0.8051

0.17460.05930.57110.6900-0.0592

0.28770.11390.71430.71190.2193

0.32730.72580.85800.81560.2573

1.18921.06681.25401.19080.5287

1.19092.18321.62361.29021.4151

L=-sort(-A,2,'descend')

L=

-1.6041-0.4326-0.3999-0.18670.2944

-1.6656-1.33620.25730.69000.7258

-1.0565-0.58830.12530.71430.8156

0.28770.71191.41511.62362.1832

-1.1465-0.8051-0.6918-0.13641.2902

0.11390.52870.66860.85801.1909

0.21931.06681.18921.19081.2540

-1.5937-1.2025-0.9219-0.03760.0593

-2.1707-1.4410-0.0956-0.01980.3273

-0.8323-0.1567-0.05920.17460.5711

2.

(1)

x=[0153045607590];

y=[00.25880.50000.70710.86600.96591.0000];

x1=0:

90;

y1=interp1(x,y,x1,'spline')

y1=

Columns1through11

00.01750.03490.05240.06980.08720.10450.12190.13920.15640.1737

Columns12through22

0.19080.20790.22490.24190.25880.27560.29230.30900.32550.34200.3583

Columns23through33

0.37460.39070.40670.42260.43840.45400.46950.48480.50000.51500.5299

Columns34through44

0.54460.55920.57360.58780.60180.61570.62930.64280.65610.66910.6820

Columns45through55

0.69470.70710.71930.73130.74310.75470.76600.77710.78800.79860.8090

Columns56through66

0.81910.82900.83870.84800.85710.86600.87460.88290.89100.89870.9062

Columns67through77

0.91350.92040.92710.93350.93960.94540.95100.95630.96120.96590.9703

Columns78through88

0.97440.97820.98170.98490.98780.99040.99270.99460.99630.99770.9987

Columns89through91

0.99950.99991.0000

x=[01530456075];

y=[00.26790.57741.00001.73203.7320];

x1=0:

75;

y1=interp1(x,y,x1,'spline')

y1=

Columns1through11

00.01840.03650.05450.07240.09020.10790.12550.14310.16070.1784

Columns12through22

0.19610.21380.23170.24970.26790.28630.30480.32360.34270.36200.3817

Columns23through33

0.40170.42210.44290.46410.48580.50790.53050.55370.57740.60170.6266

Columns34through44

0.65200.67800.70460.73170.75930.78760.81630.84560.87540.90580.9367

Columns45through55

0.96811.00001.03251.06581.10031.13641.17431.21451.25721.30281.3516

Columns56through66

1.40411.46041.52111.58631.65651.73201.81311.90021.99362.09372.2008

Columns67through76

2.31522.43742.56752.70602.85323.00953.17523.35063.53613.7320

x=[0153045607590];

y=[00.25880.50000.70710.86600.96591.0000];

y1=polyfit(x,y,5)

y1=

0.00000.0000-0.00000.00000.01740.0000

x=[01530456075];

y=[00.26790.57741.00001.73203.7320];

y1=polyfit(x,y,5)

y1=

0.0000-0.00000.0000-0.00100.02450.0000

(2)

x=[149162536496481100];

y=1:

10;

x1=1:

100;

y1=interp1(x,y,x1,'cubic')

y1=

Columns1through11

1.00001.37291.71252.00002.24052.45512.64942.82923.00003.16363.3186

Columns12through22

3.46613.60693.74223.87294.00004.12374.24354.35994.47304.58324.6907

Columns23through33

4.79584.89885.00005.09935.19665.29215.38575.47775.56815.65705.7446

Columns34through44

5.83095.91606.00006.08296.16476.24546.32496.40356.48106.55776.6334

Columns45through55

6.70826.78236.85566.92817.00007.07127.14167.21137.28047.34877.4164

Columns56through66

7.48357.55007.61597.68127.74597.81027.87397.93728.00008.06238.1242

Columns67through77

8.18558.24648.30688.36688.42638.48548.54418.60248.66038.71788.7749

Columns78through88

8.83178.88818.94429.00009.05559.11079.16559.22019.27449.32849.3821

Columns89through99

9.43549.48849.54129.59359.64569.69739.74869.79969.85029.90059.9505

Column100

10.0000

3.

xi=[165123150123141];

yi=[187126172125148];

P=polyfit(xi,yi,3)

P=

1.0e+003*

-0.00000.0013-0.17798.4330

线性拟合曲线为:

p(x)=1.3x^2—177.9x+8433

4.

(1)

P1=[0,3,2];

P2=[5,-1,2];

P3=[1,0,-0.5];

P=conv(P1,conv(P2,P3))

P=

015.00007.0000-3.50000.5000-2.0000-2.0000

(2)

P1=[0,3,2];

P2=[5,-1,2];

P3=[1,0,-0.5];

P=conv(P1,conv(P2,P3));

Y=roots(P)

Y=

0.7071

0.1000+0.6245i

0.1000-0.6245i

-0.7071

-0.6667

(3)

P1=[0,3,2];

P2=[5,-1,2];

P3=[1,0,-0.5];

P=conv(P1,conv(P2,P3));

k=0:

10;

xi=0.2*k;

Y=polyval(P,xi)

Y=

-2.0000-2.3920-2.6112-1.70242.710415.000042.112094.1408184.9056332.5264560.0000

5.

(1)

[U,fmin]=fminsearch('xiti651',[1,1])

U=

1.0e-004*

-0.06750.1715

fmin=

1.9920e-010

(2)

f=inline('-sin(x)-cos(x.^2)');

fminbnd(f,0,pi)

ans=

0.7310

6.

(1)

x=[pi/6pi/4pi/3pi/2];

f=inline('sin(x).^2+cos(x).^2');

dx=diff(f([x,5*pi/12]))/(pi/12)

dx=

0000

(2)

x=1:

3;

f=inline('sqrt(x.^2+1)');

dx=diff(f([x,4]))

dx=

0.82190.92620.9608

7.

(1)

g=inline('sin(x).^5.*sin(5*x)');

I=quadl(g,0,pi)

I=

0.0982

(2)

g=inline('(1+x.^2)./(1+x.^4)');

I=quad(g,-1,1)

I=

2.2214

(3)

g=inline('(x.*sin(x))./(1+cos(x).^2)');

I=quadl(g,0,pi)

I=

2.4674

(4)

f=inline('abs(cos(x+y))');

dblquad(f,0,pi,0,pi)

ans=

6.2832

9.

(1)

矩阵求逆法:

A=[2,3,5;3,7,4;1,-7,1];

b=[10;3;5];

x=inv(A)*b

x=

-1.8060

-0.5373

3.0448

矩阵除法:

A=[2,3,5;3,7,4;1,-7,1];

b=[10;3;5];

x=A\b

x=

-1.8060

-0.5373

3.0448

矩阵分解法:

A=[2,3,5;3,7,4;1,-7,1];

b=[10;3;5];

[Q,R]=qr(A);

x=R\(Q\b)

x=

-1.8060

-0.5373

3.0448

(2)

矩阵求逆法:

A=[5,1,-1,0;1,0,3,-1;-1,-1,0,5;0,0,2,4];

b=[1;2;3;-1];

x=inv(A)*b

x=

1.4000

-5.9000

0.1000

-0.3000

矩阵除法:

A=[5,1,-1,0;1,0,3,-1;-1,-1,0,5;0,0,2,4];

b=[1;2;3;-1];

x=A\b

x=

1.4000

-5.9000

0.1000

-0.3000

矩阵分解法:

A=[5,1,-1,0;1,0,3,-1;-1,-1,0,5;0,0,2,4];

b=[1;2;3;-1];

[Q,R]=qr(A);

x=R\(Q\b)

x=

1.4000

-5.9000

0.1000

-0.3000

10.

A=[21-11;42-21;21-1-1];

b=[1;2;1];

[x,y]=line_solution(A,b)

原方程组有无穷个解,特解为x,齐次方程组的基础解系为y

Warning:

Rankdeficient,rank=2,tol=4.3512e-015.

>Inline_solutionat11

方程组无解

x=

[]

y=

-0.50000.5000

1.00000

01.0000

00

11.

(1)

f=inline('x-sin(x)./x');

x=fzero(f,0.5)

x=

0.8767

(2)

f=inline('(sin(x).^2).*exp(-0.1.*x)-0.5.*abs(x)');

x=fzero(f,1.5)

x=

1.6738

12.

x=fsolve('xiti612',[0.5,0.5],optimset('Display','off'))

x=

0.5000

y=

0.5000

f=

-0.0509

f=

-0.05090.1173

x=

0.5000

y=

0.5000

f=

-0.0509

f=

-0.05090.1173

x=

0.5000

y=

0.5000

f=

-0.0509

f=

-0.05090.1173

x=

0.6459

y=

0.3739

f=

0.0055

f=

0.00550.0044

x=

0.6459

y=

0.3739

f=

0.0055

f=

0.00550.0044

x=

0.6459

y=

0.3739

f=

0.0055

f=

0.00550.0044

x=

0.6355

y=

0.3734

f=

1.9417e-005

f=

1.0e-004*

0.19420.2589

x=

0.6355

y=

0.3734

f=

1.9425e-005

f=

1.0e-004*

0.19420.2589

x=

0.6355

y=

0.3734

f=

1.9419e-005

f=

1.0e-004*

0.19420.2591

x=

0.6354

y=

0.3734

f=

2.3754e-010

f=

1.0e-009*

0.23750.2957

x=

0.6354

y=

0.3734

f=

7.9432e-009

f=

1.0e-008*

0.79430.5602

x=

0.6354

y=

0.3734

f=

1.8684e-009

f=

1.0e-007*

0.01870.1936

x=

0.63540.3734

13.

x0=0;xf=20;

y1=0;

[x,y]=ode45('xiti6131',[x0,xf],y1)

x=

0

0.5000

1.0000

1.5000

2.0000

2.5000

3.0000

3.5000

4.0000

4.5000

5.0000

5.5000

6.0000

6.5000

7.0000

7.5000

8.0000

8.5000

9.0000

9.5000

10.0000

10.5000

11.0000

11.5000

12.0000

12.5000

13.0000

13.5000

14.0000

14.5000

15.0000

15.5000

16.0000

16.5000

17.0000

17.5000

18.0000

18.5000

19.0000

19.5000

20.0000

y=

0

NaN

NaN

NaN

NaN

NaN

NaN

NaN

NaN

NaN

NaN

NaN

NaN

NaN

NaN

NaN

NaN

NaN

NaN

NaN

NaN

NaN

NaN

NaN

NaN

NaN

NaN

NaN

NaN

NaN

NaN

NaN

NaN

NaN

NaN

NaN

NaN

NaN

NaN

NaN

NaN

(2)

x0=0;xf=20;

[x,y]=ode45('xiti6132',[x0,xf],[-3,2])

[x,y]

此题结果过长,疑似错误或不会做。

14.

f=@(t,x)[-8/3*x

(1)+x

(2)*x(3);-10*x

(2)+10*x(3);-x

(1)*x

(2)+28*x

(2)-x(3)];

t_f=100;

x0=[0;0;1e-10];

[t,x]=ode45(f,[0,t_f],x0)

figure

(2);

plot3(x(:

1),x(:

2),x(:

3));

axis([1040-2020-2020])

t=

0

0.1250

0.2500

0.3750

0.5000

0.5352

0.5705

0.6057

0.6409

0.6761

0.7114

0.7466

0.7818

0.8308

0.8797

0.9286

0.9776

1.0105

1.0434

1.0763

1.1092

1.1421

1.1750

1.2079

1.2409

1.2797

1.3186

1.3575

1.3964

1.4246

1.4528

1.4810

1.5092

1.5374

1.5656

1.5938

1.6220

1.6479

1.6737

1.6996

1.7255

1.7506

1.7757

1.8008

1.8259

1.8507

1.8755

1.9004

1.9252

1.9495

1.9739

1.9982

2.0225

2.0467

2.0709

2.0950

2.1192

2.1432

2.1672

2.1912

2.2152

2.2384

2.2616

2.2848

2.3081

2.3201

2.3321

2.3442

2.3562

2.3682

2.3803

2.3923

2.4044

2.4154

2.4265

2.4376

2.4487

2.4585

2.4684

2.4783

2.4882

2.4976

2.5069

2.5163

2.5257

2.5420

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 法律文书 > 调解书

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1