1. Give the answer of the following questions for the array
1)What is the size of array1? 4 5
2)What is the value of array1(4,1)? -1.4
3)What is the size and value of array1(:,1:2)? 4 2
ans =
1.1000 0
0 1.1000
2.1000 0.1000
-1.4000 5.1000
4)What is the size and value of array1([1 3], end)? 2 1
ans =
6.0000
matlab求导 1.3000
2. Give the answer of the following commad
1) a=1:2:5; 1 3 5
2) b=[a’ a’ a’];
b =
1 1 1
3 3 3
5 5 5
3) c=b(1:2:3,1:2:3);
c =
1 1
5 5
4) d=a+b(2,:)
d =
4 6 8
5) w=[zeros(1,3) ones(3,1)’ 3:5’]
w =
0 0 0 1 1 1 3 4 5
3. Give the answer of the sub-arrays
1)array1(3,:);
ans =
2.1000 0.1000 0.3000 -0.4000 1.3000
2)2) array1(:,3);
ans =
2.1000
-6.6000
0.3000
0
3)3) array1(1:2:3,[3 3 4])
ans =
2.1000 2.1000 -3.5000
0.3000 0.3000 -0.4000
4)4) array1([1 1],:)
ans =
1.1000 0 2.1000 -3.5000 6.0000
1.1000 0 2.1000 -3.5000 6.0000
4. Give the answer of the following operations
1)a+b
ans =
3 -3
-1 4
2)a*d
ans =
2 -2
-1 2
3)a.*d
ans =
2 0
0 2
4)a*c
ans =
6
-5
5)a.*c ERROR
6)a\b
ans =
1.0000 1.0000
0.5000 1.5000
7)a.\b
ans =
0.5000 0.5000
0 1.0000
8)a.^b
ans =
2.0000 -0.5000
1.0000 4.0000
1.Edit & Run the m-file
% test step response function
wn=6; kosi=[0.1:0.1:1.0 2];
figure(1); hold on
for kos=kosi
num=wn^2; den=[1,2*kos*wn,wn.^2]; step(num,den)
end
hold off;
2.Edit & Run the m-file
发布评论