精讲多练matlab课后答案

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

第一章

习题2

function xt12

A=1.2;B=-4.6;C=8.0;D=3.5;E=-4.0;

T=atan((2*pi*A+E/(2*pi*B*C))/D);

disp('计算结果为:')

disp(['T=',num2str(T)])

>> xt12

计算结果为:

T=1.1371

>>

习题3

function xt13

x=45*pi/180;T=(sin(x)+sqrt(35))/35^0.2; disp(['计算结果为:',num2str(T)])

>> xt13

计算结果为:3.2528

>>

习题4

function xt14

a=5.76;b=7.811;

T=exp(a+b)/log10(a+b);

disp('计算结果为:')

disp(['T=',num2str(T)])

>> xt14

计算结果为:

T=691399.9003

习题5

function xt15

x=3;

y=sqrt(x)-6*(x+1/x)+(x-3.2)^2/(x+7.7)^3; disp('计算结果为:')

disp(['y=',num2str(y)])

>> xt15

计算结果为:

y=-18.2679

习题6

function xt16

r=15;

c=2*pi*r;s=pi*r^2;

disp(['圆的周长c=',num2str(c)])

disp(['圆的面积s=',num2str(s)])

>> xt16

圆的周长c=94.2478

圆的面积s=706.8583

习题7

function xt17

a=8.5;b=14.6;c=18.4;

s=(a+b+c)/2;

are=sqrt(s*(s-a)*(s-b)*(s-c));

disp(['所求三角形的面积是:are=',num2str(c)]) >> xt17

所求三角形的面积是:are=18.4

第三章

1.

x=sym('x');

limit((cos(sqrt(x)))^(pi/x),x,0,'right')

ans =

exp(-1/2*pi)

2.

x=sym('x');

f=sym('(3*sin(x)+x^2*cos(1/x))/((1+cos(x))*log(1+x))'); limit(f,x,0)

ans =

3/2

3.

x=sym('x');

f=sym('(sqrt(4*x^2+x-1)+x+1)/sqrt(x^2+sin(x))');

limit(f,x,-inf)

ans =

1

4.

syms x y;

f=sym('(x^2+y^2)^(x^2*y^2)');

limit(limit(f,x,0),y,0)

ans =

1

x=sym('x');

y=sym('(tan(sqrt(x+sqrt(x+sqrt(2*x)))))^2');

diff(y,x)

ans =

tan((x+(x+2^(1/2)*x^(1/2))^(1/2))^(1/2))*(1+tan((x+(x+2^(1/2)*x^(1/2))^(1/2))^(1/2))^2)/(x+(x+2^(1 /2)*x^(1/2))^(1/2))^(1/2)*(1+1/2/(x+2^(1/2)*x^(1/2))^(1/2)*(1+1/2*2^(1/2)/x^(1/2)))

6.

x=sym('x');

y=sym('cos(x^2)*sin(1/x)^2');

diff(y,x)

ans =

-2*sin(x^2)*x*sin(1/x)^2-2*cos(x^2)*sin(1/x)*cos(1/x)/x^2

7.

x=sym('x');

y=sym('sqrt(sin(x)-sin(x)^3)');

int(y,x,0,pi)

ans =

4/3

8.

x=sym('x');

y=sym('sqrt((x+1)/(x-1))/x');

int(y,x)

ans =

-((1+x)/(x-1))^(1/2)*(x-1)*(atan(1/(-1+x^2)^(1/2))-log(x+(-1+x^2)^(1/2)))/((1+x)*(x-1))^(1/2)

9.

dsolve('D2y+4*Dy+4*y=exp(-2*x)','x')

ans =

1/2*exp(-2*x)*(2*C2+2*x*C1+x^2)

10.

dsolve('x^2*Dy+x*y=y^2','y(1)=1')

ans =

x*exp(1/x)/(exp(1/x)+exp(1/x*t)*x-exp(1/x*t))

第四章

1.

plot([1 2 4 0 5 10 11 21 3 1])

2.

t=0:pi/100:2*pi;

x=cos(t);

y=sin(t);

plot(x,y);

axis('square');

3.

R=[1 5 10 20];

I=0:0.1:10;

U=I'*R;

plot(I,U);

4.

mon=1:12;

temp=[0.2 2.3 8.7 18.5 24.6 32.1 36.8 37.1 28.3 17.8 6.4 -3.2];

rainf=[4.6 3.6 2.1 2.9 3.0 2.7 2.2 2.5 4.3 3.4 2.1 3.7];

plot(mon,temp,'r-p',mon,rainf,'b:s');

xlabel('month');

ylabel('temperature and rainfall');

%title('Temperature and Rainfall Curve');

%text(3,1,'rainfall');

%text(9,28.3,'temperature');

flag=12;

while(flag)

text(mon(flag),temp(flag),[num2str(mon(flag)),num2str(temp(flag))]);

text(mon(flag),rainf(flag),[num2str(mon(flag)),num2str(rainf(flag))]);

flag=flag-1;

end

5.

A=[1 1 1 1 1 1 1;1 2 2 2 2 2 1;1 2 2 3 2 2 1;1 2 2 2 2 2 1;1 1 1 1 1 1 1]; plot(A);

6.

x=-10:0.5:10;

y=x;

[X,Y]=meshgrid(x,y);

Z=X.^2+Y.^2;

surf(X,Y,Z);

7.

clc

clear

theta=(0:0.1:2)*pi;

phi=(0:0.1:2)*pi;

x=zeros(length(theta),length(phi));

y=x;

相关文档
最新文档