Добавил:
korayakov
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Мат Моделирование 2002 (ЛисовЕЦ) / лабы / labs2004 / lab1 / report_long
.txt % 5
>> x=[1 1.1 1.2 1.3 1.4 1.5]
x =
Columns 1 through 5
1.0000 1.1000 1.2000 1.3000 1.4000
Column 6
1.5000
>> y=[1 2 3 4 5 6]
y =
1 2 3 4 5 6
>> x=x'
x =
1.0000
1.1000
1.2000
1.3000
1.4000
1.5000
>> y=y'
y =
1
2
3
4
5
6
>> x+y
ans =
2.0000
3.1000
4.2000
5.3000
6.4000
7.5000
>> x-y
ans =
0
-0.9000
-1.8000
-2.7000
-3.6000
-4.5000
>> 3*x+5*y
ans =
8.0000
13.3000
18.6000
23.9000
29.2000
34.5000
>> x.*y
ans =
1.0000
2.2000
3.6000
5.2000
7.0000
9.0000
>> x=x'
x =
Columns 1 through 5
1.0000 1.1000 1.2000 1.3000 1.4000
Column 6
1.5000
>> x*y
ans =
28
>> y=1:6
y =
1 2 3 4 5 6
>> x=1:0.1:1.4
x =
1.0000 1.1000 1.2000 1.3000 1.4000
>> pr1
x =
Columns 1 through 5
1.0000 1.1000 1.2000 1.3000 1.4000
Column 6
1.5000
y =
1 2 3 4 5 6
x =
1.0000
1.1000
1.2000
1.3000
1.4000
1.5000
y =
1
2
3
4
5
6
ans =
2.0000
3.1000
4.2000
5.3000
6.4000
7.5000
ans =
0
-0.9000
-1.8000
-2.7000
-3.6000
-4.5000
ans =
8.0000
13.3000
18.6000
23.9000
29.2000
34.5000
x =
Columns 1 through 5
1.0000 1.1000 1.2000 1.3000 1.4000
Column 6
1.5000
ans =
28
y =
1 2 3 4 5 6
x =
1.0000 1.1000 1.2000 1.3000 1.4000
>> pr1
x =
1.0000 1.1000 1.2000 1.3000 1.4000
>> qvadrat(2)
y =
4
ans =
4
% 6
>> help ones
ONES Ones array.
ONES(N) is an N-by-N matrix of ones.
ONES(M,N) or ONES([M,N]) is an M-by-N matrix of ones.
ONES(M,N,P,...) or ONES([M N P ...]) is an M-by-N-by-P-by-...
array of ones.
ONES(SIZE(A)) is the same size as A and all ones.
See also ZEROS.
>> a=ones(2,3)
x =
1 1 1
1 1 1
>> b=zeros(3,2)
y =
0 0
0 0
0 0
% 7
>> who
Your variables are:
a ans b x y
>> whos
Name Size Bytes Class
a 2x3 48 double array
ans 1x1 8 double array
b 3x2 48 double array
x 1x5 40 double array
y 1x6 48 double array
Grand total is 24 elements using 192 bytes
% 8
>> a(1,:)=x(1:3)
a =
1.0000 1.1000 1.2000
1.0000 1.0000 1.0000
>> a(2,:)=x(3:5)
a =
1.0000 1.1000 1.2000
1.2000 1.3000 1.4000
>> b(:,1)=y(1:3)
b =
1 0
2 0
3 0
>> b(:,2)=y(4:6)
b =
1 4
2 5
3 6
>> c=b
c =
1 4
2 5
3 6
>> l=b(:,2)>4
l =
0
1
1
>> c=c(l,:)
c =
2 5
3 6
>> d = a(:,1:2)
d =
1.0000 1.1000
1.2000 1.3000
>> d = a(:,[1 3])
d =
1.0000 1.2000
1.2000 1.4000
% 9
>> x(1)=-6
x =
-6.0000 1.1000 1.2000 1.3000 1.4000
>> x(8)=abs(x(1))
x =
Columns 1 through 7
-6.0000 1.1000 1.2000 1.3000 1.4000 0 0
Column 8
6.0000
>> x=x'
x =
-6.0000
1.1000
1.2000
1.3000
1.4000
0
0
6.0000
% 10
>> e=[a; 7 8 9 ]
e =
1.0000 1.1000 1.2000
1.2000 1.3000 1.4000
7.0000 8.0000 9.0000
>> e=e'
e =
1.0000 1.2000 7.0000
1.1000 1.3000 8.0000
1.2000 1.4000 9.0000
>> rank(e)
ans =
2
>> e(3,3)=10
e =
1.0000 1.2000 7.0000
1.1000 1.3000 8.0000
1.2000 1.4000 10.0000
>> rank(e)
ans =
3
>> det(e)
ans =
-0.0200
>> inv(e)
ans =
-90.0000 110.0000 -25.0000
70.0000 -80.0000 15.0000
1.0000 -2.0000 1.0000
>> eig(e)
ans =
12.0186
-0.0058
0.2872
>> [V,D]=eig(e)
V =
-0.4887 -0.7985 -0.7693
-0.5535 0.6019 -0.6121
-0.6744 0.0115 0.1833
D =
12.0186 0 0
0 -0.0058 0
0 0 0.2872
% 11
>> for i=1:3,for j=1:3,e(i,j)=sin(i*j),pause,end,end
e =
0.8415 1.2000 7.0000
1.1000 1.3000 8.0000
1.2000 1.4000 10.0000
e =
0.8415 0.9093 7.0000
1.1000 1.3000 8.0000
1.2000 1.4000 10.0000
e =
0.8415 0.9093 0.1411
1.1000 1.3000 8.0000
1.2000 1.4000 10.0000
e =
0.8415 0.9093 0.1411
0.9093 1.3000 8.0000
1.2000 1.4000 10.0000
e =
0.8415 0.9093 0.1411
0.9093 -0.7568 8.0000
1.2000 1.4000 10.0000
e =
0.8415 0.9093 0.1411
0.9093 -0.7568 -0.2794
1.2000 1.4000 10.0000
e =
0.8415 0.9093 0.1411
0.9093 -0.7568 -0.2794
0.1411 1.4000 10.0000
e =
0.8415 0.9093 0.1411
0.9093 -0.7568 -0.2794
0.1411 -0.2794 10.0000
e =
0.8415 0.9093 0.1411
0.9093 -0.7568 -0.2794
0.1411 -0.2794 0.4121
>> for i=1:3,for j=1:3,e(i,j)=sin(i*j);,end,end
>> e
e =
0.8415 0.9093 0.1411
0.9093 -0.7568 -0.2794
0.1411 -0.2794 0.4121
>> rank(e)
ans =
3
>> det(e)
ans =
-0.7255
>> inv(e)
ans =
0.5375 0.5709 0.2030
0.5709 -0.4505 -0.5009
0.2030 -0.5009 2.0173
>> eig(e)
ans =
-1.2279
0.4715
1.2531
>> [V,D]=eig(e)
V =
-0.4058 0.0619 -0.9118
0.8945 -0.1776 -0.4102
0.1873 0.9822 -0.0167
D =
-1.2279 0 0
0 0.4715 0
0 0 1.2531
>> for i=1:3
for j=1:3
e(i,j)=sin(i*j);
end
end
>> e
e =
0.8415 0.9093 0.1411
0.9093 -0.7568 -0.2794
0.1411 -0.2794 0.4121
>> pr_02
e =
0.8415 0.9093 0.1411
0.9093 -0.7568 -0.2794
0.1411 -0.2794 0.4121
% 12
>> clear
>> clc
>> who
>> whos
% 13
>> for i=1:3
for j=1:4
if i==j,
a(i,j)=2;
elseif abs(i-j)==1,
a(i,j)=-1;
else
a(i,j)=0;
end
end
end
>> a
a =
2 -1 0 0
-1 2 -1 0
0 -1 2 -1
>> x=[1 1.1 1.2 1.3 1.4 1.5]
x =
Columns 1 through 5
1.0000 1.1000 1.2000 1.3000 1.4000
Column 6
1.5000
>> y=[1 2 3 4 5 6]
y =
1 2 3 4 5 6
>> x=x'
x =
1.0000
1.1000
1.2000
1.3000
1.4000
1.5000
>> y=y'
y =
1
2
3
4
5
6
>> x+y
ans =
2.0000
3.1000
4.2000
5.3000
6.4000
7.5000
>> x-y
ans =
0
-0.9000
-1.8000
-2.7000
-3.6000
-4.5000
>> 3*x+5*y
ans =
8.0000
13.3000
18.6000
23.9000
29.2000
34.5000
>> x.*y
ans =
1.0000
2.2000
3.6000
5.2000
7.0000
9.0000
>> x=x'
x =
Columns 1 through 5
1.0000 1.1000 1.2000 1.3000 1.4000
Column 6
1.5000
>> x*y
ans =
28
>> y=1:6
y =
1 2 3 4 5 6
>> x=1:0.1:1.4
x =
1.0000 1.1000 1.2000 1.3000 1.4000
>> pr1
x =
Columns 1 through 5
1.0000 1.1000 1.2000 1.3000 1.4000
Column 6
1.5000
y =
1 2 3 4 5 6
x =
1.0000
1.1000
1.2000
1.3000
1.4000
1.5000
y =
1
2
3
4
5
6
ans =
2.0000
3.1000
4.2000
5.3000
6.4000
7.5000
ans =
0
-0.9000
-1.8000
-2.7000
-3.6000
-4.5000
ans =
8.0000
13.3000
18.6000
23.9000
29.2000
34.5000
x =
Columns 1 through 5
1.0000 1.1000 1.2000 1.3000 1.4000
Column 6
1.5000
ans =
28
y =
1 2 3 4 5 6
x =
1.0000 1.1000 1.2000 1.3000 1.4000
>> pr1
x =
1.0000 1.1000 1.2000 1.3000 1.4000
>> qvadrat(2)
y =
4
ans =
4
% 6
>> help ones
ONES Ones array.
ONES(N) is an N-by-N matrix of ones.
ONES(M,N) or ONES([M,N]) is an M-by-N matrix of ones.
ONES(M,N,P,...) or ONES([M N P ...]) is an M-by-N-by-P-by-...
array of ones.
ONES(SIZE(A)) is the same size as A and all ones.
See also ZEROS.
>> a=ones(2,3)
x =
1 1 1
1 1 1
>> b=zeros(3,2)
y =
0 0
0 0
0 0
% 7
>> who
Your variables are:
a ans b x y
>> whos
Name Size Bytes Class
a 2x3 48 double array
ans 1x1 8 double array
b 3x2 48 double array
x 1x5 40 double array
y 1x6 48 double array
Grand total is 24 elements using 192 bytes
% 8
>> a(1,:)=x(1:3)
a =
1.0000 1.1000 1.2000
1.0000 1.0000 1.0000
>> a(2,:)=x(3:5)
a =
1.0000 1.1000 1.2000
1.2000 1.3000 1.4000
>> b(:,1)=y(1:3)
b =
1 0
2 0
3 0
>> b(:,2)=y(4:6)
b =
1 4
2 5
3 6
>> c=b
c =
1 4
2 5
3 6
>> l=b(:,2)>4
l =
0
1
1
>> c=c(l,:)
c =
2 5
3 6
>> d = a(:,1:2)
d =
1.0000 1.1000
1.2000 1.3000
>> d = a(:,[1 3])
d =
1.0000 1.2000
1.2000 1.4000
% 9
>> x(1)=-6
x =
-6.0000 1.1000 1.2000 1.3000 1.4000
>> x(8)=abs(x(1))
x =
Columns 1 through 7
-6.0000 1.1000 1.2000 1.3000 1.4000 0 0
Column 8
6.0000
>> x=x'
x =
-6.0000
1.1000
1.2000
1.3000
1.4000
0
0
6.0000
% 10
>> e=[a; 7 8 9 ]
e =
1.0000 1.1000 1.2000
1.2000 1.3000 1.4000
7.0000 8.0000 9.0000
>> e=e'
e =
1.0000 1.2000 7.0000
1.1000 1.3000 8.0000
1.2000 1.4000 9.0000
>> rank(e)
ans =
2
>> e(3,3)=10
e =
1.0000 1.2000 7.0000
1.1000 1.3000 8.0000
1.2000 1.4000 10.0000
>> rank(e)
ans =
3
>> det(e)
ans =
-0.0200
>> inv(e)
ans =
-90.0000 110.0000 -25.0000
70.0000 -80.0000 15.0000
1.0000 -2.0000 1.0000
>> eig(e)
ans =
12.0186
-0.0058
0.2872
>> [V,D]=eig(e)
V =
-0.4887 -0.7985 -0.7693
-0.5535 0.6019 -0.6121
-0.6744 0.0115 0.1833
D =
12.0186 0 0
0 -0.0058 0
0 0 0.2872
% 11
>> for i=1:3,for j=1:3,e(i,j)=sin(i*j),pause,end,end
e =
0.8415 1.2000 7.0000
1.1000 1.3000 8.0000
1.2000 1.4000 10.0000
e =
0.8415 0.9093 7.0000
1.1000 1.3000 8.0000
1.2000 1.4000 10.0000
e =
0.8415 0.9093 0.1411
1.1000 1.3000 8.0000
1.2000 1.4000 10.0000
e =
0.8415 0.9093 0.1411
0.9093 1.3000 8.0000
1.2000 1.4000 10.0000
e =
0.8415 0.9093 0.1411
0.9093 -0.7568 8.0000
1.2000 1.4000 10.0000
e =
0.8415 0.9093 0.1411
0.9093 -0.7568 -0.2794
1.2000 1.4000 10.0000
e =
0.8415 0.9093 0.1411
0.9093 -0.7568 -0.2794
0.1411 1.4000 10.0000
e =
0.8415 0.9093 0.1411
0.9093 -0.7568 -0.2794
0.1411 -0.2794 10.0000
e =
0.8415 0.9093 0.1411
0.9093 -0.7568 -0.2794
0.1411 -0.2794 0.4121
>> for i=1:3,for j=1:3,e(i,j)=sin(i*j);,end,end
>> e
e =
0.8415 0.9093 0.1411
0.9093 -0.7568 -0.2794
0.1411 -0.2794 0.4121
>> rank(e)
ans =
3
>> det(e)
ans =
-0.7255
>> inv(e)
ans =
0.5375 0.5709 0.2030
0.5709 -0.4505 -0.5009
0.2030 -0.5009 2.0173
>> eig(e)
ans =
-1.2279
0.4715
1.2531
>> [V,D]=eig(e)
V =
-0.4058 0.0619 -0.9118
0.8945 -0.1776 -0.4102
0.1873 0.9822 -0.0167
D =
-1.2279 0 0
0 0.4715 0
0 0 1.2531
>> for i=1:3
for j=1:3
e(i,j)=sin(i*j);
end
end
>> e
e =
0.8415 0.9093 0.1411
0.9093 -0.7568 -0.2794
0.1411 -0.2794 0.4121
>> pr_02
e =
0.8415 0.9093 0.1411
0.9093 -0.7568 -0.2794
0.1411 -0.2794 0.4121
% 12
>> clear
>> clc
>> who
>> whos
% 13
>> for i=1:3
for j=1:4
if i==j,
a(i,j)=2;
elseif abs(i-j)==1,
a(i,j)=-1;
else
a(i,j)=0;
end
end
end
>> a
a =
2 -1 0 0
-1 2 -1 0
0 -1 2 -1