-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHomework_ch2.m
More file actions
54 lines (40 loc) · 1.08 KB
/
Homework_ch2.m
File metadata and controls
54 lines (40 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
%5.2日作业
%------------------------------分界符----------------------------------%
%Q1
ans=5;
10;
ans+10
%------------------------------分界符----------------------------------%
%Q2
a=[-3:0.1:3];
y=sinh(0.3.*a).*sin(a+0.3)+log((0.3+a)/2)
%------------------------------分界符----------------------------------%
%Q3
A_3=[12,34,-4;34,7,87;3,65,7];
B_3=[1,3,-1;2,0,3;3,-2,7];
disp(A_3*B_3);disp(B_3*A_3);disp(A_3.*B_3);
disp(A_3^3);disp(A_3.^3);
disp(A_3/B_3);disp(B_3\A_3);
disp([A_3,B_3]);
C_3=A_3([1,3],:);
disp([C_3;B_3^2]);
%------------------------------分界符----------------------------------%
%Q4
A_4_12=[1,2,3,4,5;6,7,8,9,10];
A_4_34=A_4_12+10;
A_4_56=A_4_34+10;
A_4=[A_4_12;A_4_34;A_4_56(1,:)]
B_4=[3,0,16;17,-6,9;0,23,-4;9,7,0;4,13,11];
C_4=A_4*B_4;disp(C_4);
D_4=C_4(3:5,2:3)
whos
%------------------------------分界符----------------------------------%
% Q5
A_5=[100:999];
B_5=mod(A_5,21);
[row,col]=find(B_5==0,900);
D_5=length(col)
disp('the number is');disp(D_5);
ch='I love You'
k=find(ch>'A'& ch<'Z')
ch(k)=[]