Matlab编程与工程应用第二版习题解答全Word格式.docx
《Matlab编程与工程应用第二版习题解答全Word格式.docx》由会员分享,可在线阅读,更多相关《Matlab编程与工程应用第二版习题解答全Word格式.docx(37页珍藏版)》请在冰豆网上搜索。
![Matlab编程与工程应用第二版习题解答全Word格式.docx](https://file1.bdocx.com/fileroot1/2022-10/27/c1f1f12c-e1c1-4da9-892b-7e694eea61e9/c1f1f12c-e1c1-4da9-892b-7e694eea61e91.gif)
9.2308
9.
ftemp=90;
ctemp=<
ftemp-32>
*5/9
ctemp=
32.2222
10.略
11.
sind<
90>
1
12.
sita=2*pi/3;
r=2;
x=r*cos<
sita>
x=
-1.0000
y=r*sin<
y=
1.7321
13.
t=100;
V=50;
wcf=35.7+0.6*t-35.7+0.16*V+0.43*t*0.16*V
wcf=
412
14.
Fix<
3.5>
=3;
Floor<
3.4>
Fix<
-3.4>
=-3;
3.2>
-3.2>
=-4;
Ceil<
15.
Sqrt<
19>
3^1.2
Tan<
pi>
16.
Intmin<
‘int32’>
;
intmax<
intmin<
‘int64’>
intmax<
17.
Realmin<
‘double’>
Realmax<
18.
DblNum=33.8;
int32Num=int32<
DblNum>
int32Num=
34
19.
A1=rand;
A2=20*rand;
A3=30*rand+20;
A4=round<
rand*10>
A5=round<
rand*11>
/
A6=round<
rand*50>
+50;
A4=randi<
10>
A5=randi<
11>
A6=randi<
50>
20.略
21.
Double〔‘A’<
Double<
‘a’>
所以大写在前,小写在后;
22.
CharNum='
xyz'
CharNum=char<
CharNum-2>
CharNum=
vwx
23.
vec=[3:
1:
6]
vec=
3456
vec2=[1.0000:
0.5000:
3.0000]
vec2=
1.00001.50002.00002.50003.0000
vec3=[5:
-1:
2]
vec3=
5432
24.
vec1=linspace<
4,8,3>
vec1=
468
vec2=linspace<
-3,-15,5>
-3-6-9-12-15
vec3=linspace<
9,5,3>
975
25.
vec=[1:
10]
12345678910
vec=linspace<
1,10,10>
vec2=[2:
5:
12]
2712
2,12,3>
26.
myend=randi<
4>
+8;
vec1=[1:
3:
myend]
14710
27.
vec=[-1:
0.2:
1]'
-0.8000
-0.6000
-0.4000
-0.2000
0
0.2000
0.4000
0.6000
0.8000
1.0000
28.
vec=[0:
15];
n=[1:
2:
numel<
vec>
-1];
vec2=vec<
n>
02468101214
29.
function[ab]=PI_CONT<
x>
%UNTITLEDSummaryofthisfunctiongoeshere
%Detailedexplanationgoeshere
n=1:
fix<
numel<
/2>
a=x<
n=1+fix<
/2>
:
b=x<
end
rem<
2>
30.
rand<
2,3>
10*rand<
5+round<
15*rand<
randint<
2,3,[515]>
31.
rows=randi<
5>
cols=randi<
y=zeros<
rows,cols>
32.
mat=[78910
121086];
A1=mat<
1,3>
A2=mat<
2,:
A3=mat<
:
1:
2>
33.
mymat=[234;
567]
mymat1=fliplr<
mymat>
mymat2=flipud<
mymat3=rot90<
34.
mymatzero=zeros<
4,2>
mymatzero<
=[3,6]
35.
x=linspace<
-pi,pi,20>
y=sin<
36.
randmat=randint<
3,5,[-55]>
sign<
randmat>
37.
4,6,[-55]>
randmat2=abs<
38.
randmat=rand<
3,5>
randmat<
3,:
=[]
39.
vec=1:
1:
1000;
vec<
end>
[ab]=size<
a*b>
40.
同上
41.
mat=zeros<
mat<
:
1>
=zeros<
42.
myc=clock
today=myc<
1:
3>
now=myc<
4:
6>
now=fix<
now>
第二章MATLAB程序设计概述
ri=2;
%Radiusinternal
ro=4;
%Radiusouter
V=4*pi/3*<
ro^3-ri^3>
%calculatevolume
%CalculateAtomicWeightH2O2
Weight_O=15.9994;
Weight_H=1.0079;
AtomicWeight=Weight_O*2+Weight_H*2%CalculateH2O2AtomicWeight
fprintf<
'
LengthofThecharacterstringis:
%d\n'
…
length<
input<
Pleaseinputcharacterstring:
\n'
'
s'
4.
NewNumber=input<
pleaseinputaNumber:
Numberwith2decimalis:
%0.2f\n'
NewNumber>
vec=input<
Enteramatrix:
'
[1:
10;
10]
6.
fprintf<
OUTPUT:
%f\n'
12345.6789>
12345.678900
%10.4f\n'
12345.6789
%10.2f\n'
12345.68
%6.4f\n'
%2.4f\n'
7.
12345>
12345
%5d\n'
%8d\n'
%3d\n'
x=12.34;
y=4.56;
xis%.3f\n'
x>
xis12.340
xis%0.0f\n'
xis12
yis%0.1f\n'
y>
yis4.6
yis%0.1f!
yis4.6!
%CalculateAreaofthesquareness
TheAreaofTheSquarenessis%.2f'
<
PleaseinputtheLengthoftheSquareness\n'
…
*<
PleaseinputtheWidth