东华大学matlab数学实验-第四次答案

更新时间:2023-05-19 12:58:01 阅读量: 实用文档 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

1

>> p=[1 1 1];x=roots(p)

x =

-0.5000 + 0.8660i

-0.5000 - 0.8660i

>> polyval(p,x)

ans =

1.0e-15 *

0.3331

0.3331

>> clear;

>> p=[3 0 -4 2 -1];x=roots(p)

x =

-1.4058 + 0.0000i

1.0000 + 0.0000i

0.2029 + 0.4427i

0.2029 - 0.4427i

>> polyval(p,x)

ans =

1.0e-13 *

-0.2498 + 0.0000i

-0.0266 + 0.0000i

0.0000 + 0.0072i

0.0000 - 0.0072i

>> clear;

>> p=[5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -6 8 0 0 0 -5 0 0];x=roots(p)

x =

0.0000 + 0.0000i

0.0000 + 0.0000i

0.9768 + 0.0000i

0.9388 + 0.2682i

0.9388 - 0.2682i

0.8554 + 0.5363i

0.8554 - 0.5363i

0.6615 + 0.8064i

0.6615 - 0.8064i

0.3516 + 0.9878i

0.3516 - 0.9878i

-0.0345 + 1.0150i

-0.0345 - 1.0150i

-0.4609 + 0.9458i

-0.4609 - 0.9458i

-0.1150 + 0.8340i

-0.1150 - 0.8340i

-0.7821 + 0.7376i

-0.7821 - 0.7376i

-0.9859 + 0.4106i

-0.9859 - 0.4106i

-1.0416 + 0.0000i

-0.7927 + 0.0000i

>> polyval(p,x)

ans =

1.0e-12 *

0.0000 + 0.0000i

0.0000 + 0.0000i

0.1305 + 0.0000i

0.0954 + 0.0245i

0.0954 - 0.0245i

0.0796 + 0.0419i

0.0796 - 0.0419i

-0.0643 + 0.0680i

-0.0643 - 0.0680i

0.1620 + 0.0550i

0.1620 - 0.0550i

-0.0120 + 0.0557i

-0.0120 - 0.0557i

-0.0978 + 0.3836i

-0.0978 - 0.3836i

0.0012 + 0.0121i

0.0012 - 0.0121i

0.0560 - 0.1047i

0.0560 + 0.1047i

0.2392 + 0.0861i

0.2392 - 0.0861i

-0.0636 + 0.0000i

0.0011 + 0.0000i

>> p1=[2 3];

>> p2=conv(p1,p1);

>> p=conv(p2,p1)

p =

8 36 54 27

>> p3=[8 36 54 23];x=roots(p3)

x =

-1.8969 + 0.6874i

-1.8969 - 0.6874i

-0.7063 + 0.0000i

>> polyval(p3,x)

ans =

1.0e-13 *

0.1066 + 0.0799i

0.1066 - 0.0799i

0.0355 + 0.0000i

>>

2

>> clear;

>> fun=@ (x)(x*log(sqrt(x^2-1)+x)-sqrt(x^2-1)-x/2);

>>fplot(fun,[0,10])

>> fzero(fun,2)

ans =

2.1155

3

>> fun=@ (x)[7/10*sin(x(1))+2/10*cos(x(2))-x(1),7/10*cos(x(1))-2/10*sin(x(2))-x(2)]; >> [x,f,h]=fsolve(fun,[0,0])

Equation solved.

fsolve completed because the vector of function values is near zero

as measured by the default value of the function tolerance, and

the problem appears regular as measured by the gradient.

<stopping criteria details>

x =

0.5265 0.5079

f =

1.0e-09 *

-0.2859 -0.4618

h =

1

>>

9(1)

clear;

>> xa=-2:1;ya=-7:1;

>> [x,y]=meshgrid(xa,ya);

>> z=y.^3/9+3*x.^2.*y+9*x.^2+y.^2+x.*y+9;

>> mesh(x,y,z)

(2)

>> clear;

>> fun=@ (x)x(2).^3/9+3*x(1).^2.*x(2)+9*x(1).^2+x(2).^2+x(1).*x(2)+9; >> [x,g]=fminsearch(fun,[0,0])

x =

0 0

g =

9

>> fun=@ (x)-(x(2).^3/9+3*x(1).^2.*x(2)+9*x(1).^2+x(2).^2+x(1).*x(2)+9); >> [x,g]=fminsearch(fun,[0,-6])

x =

-0.3333 -6.0000

g =

-22.0000

12

>> clear;

>> all=180*7500

all =

1350000

>> first=all*3/10

first =

405000

>> x=all*7/10

x =

945000

>> r=504/12/10000

r =

0.0042

>> n=20*12

n =

240

>> a=((1+r)^n*r*x)/((1+r)^n-1)

a =

6.2575e+03

>> x=x-100000

x =

845000

>> a=((1+r)^n*r*x)/((1+r)^n-1)

a =

5.5953e+03

>> r=405/10000/12

r =

0.0034

>> x=100000

x =

100000

>> a=((1+r)^n*r*x)/((1+r)^n-1)

a =

608.6182

>> 5.5953e+03+a

ans =

6.2039e+03

>>

本文来源:https://www.bwwdw.com/article/5xl4.html

Top