A = pascal(7) %生成7*7 pascal矩阵
B = A([1,3,5],[5,6,7]) %构成矩阵B
C = A(5:7,1:3)%构成矩阵C
D = B-1*C
A =
1 1 1 1 1 1 1
1 2 3 4 5 6 7
1 3 610152128
1 41020355684
1 5153570 126 210
1 62156 126 252 462
1 72884 210 462 924
B =
1 1 1
152128
70 126 210
C =
1 515
1 621
1 728
D =
0-4 -14
1415 7
69 119 182
第二题:
function A=prime_number()
N=100
j=1
for i=2:N
if prod(rem(i,2:(i-1)))~=0
A(j)=i
j=j+1
end
end
A =
2 3 5 7111317192329313741434753596167717379838997
x1=-pi/2:0.01:pi/2syms x y
y1=cos(x1).^0.5
y2=(x^2)/4+(y^2)/16
subplot(2,2,2)
plot(x1,y1)
subplot(2,2,3)
ezsurf(y2,[-2,2,-4,4])
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)