Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
matlab.docx
Скачиваний:
0
Добавлен:
01.05.2025
Размер:
46.92 Кб
Скачать

Задание 3! Вариант 6

a = [3.5 6.8 -7.1 6.8 -5.0 -2.3 -4.4 -0.2]

b = [5.5 1.5 5.7 -4.6 -2.3 -5.3 5.5 2.3]

Решение:

>> a = [3.5 6.8 -7.1 6.8 -5.0 -2.3 -4.4 -0.2],b = [5.5 1.5 5.7 -4.6 -2.3 -5.3 5.5 2.3]

a =

Columns 1 through 4

3.5 6.8 -7.1 6.8

Columns 5 through 8

-5 -2.3 -4.4 -0.2

b =

Columns 1 through 4

5.5 1.5 5.7 -4.6

Columns 5 through 8

-2.3 -5.3 5.5 2.3

>> disp(a+b)

Columns 1 through 4

9 8.3 -1.4 2.2

Columns 5 through 8

-7.3 -7.6 1.1 2.1

>> disp(a-b)

Columns 1 through 4

-2 5.3 -12.8 11.4

Columns 5 through 8

-2.7 3 -9.9 -2.5

>> F=dot(a,b)

F =

-43.27

>> c=[a b]

c =

Columns 1 through 4

3.5 6.8 -7.1 6.8

Columns 5 through 8

-5 -2.3 -4.4 -0.2

Columns 9 through 12

5.5 1.5 5.7 -4.6

Columns 13 through 16

-2.3 -5.3 5.5 2.3

>> c=[a,b]

c =

Columns 1 through 4

3.5 6.8 -7.1 6.8

Columns 5 through 8

-5 -2.3 -4.4 -0.2

Columns 9 through 12

5.5 1.5 5.7 -4.6

Columns 13 through 16

-2.3 -5.3 5.5 2.3

>> [M,p]=max(c),[N,i]=min(c)

M =

6.8

p =

2

N =

-7.1

i =

3

>> c(p)=M;c(i)=N

c =

Columns 1 through 4

3.5 6.8 -7.1 6.8

Columns 5 through 8

-5 -2.3 -4.4 -0.2

Columns 9 through 12

5.5 1.5 5.7 -4.6

Columns 13 through 16

-2.3 -5.3 5.5 2.3

>> vz=sort(c)

vz =

Columns 1 through 4

-7.1 -5.3 -5 -4.6

Columns 5 through 8

-4.4 -2.3 -2.3 -0.2

Columns 9 through 12

1.5 2.3 3.5 5.5

Columns 13 through 16

5.5 5.7 6.8 6.8

>> yb=-sort(-c)

yb =

Columns 1 through 4

6.8 6.8 5.7 5.5

Columns 5 through 8

5.5 3.5 2.3 1.5

Columns 9 through 12

-0.2 -2.3 -2.3 -4.4

Columns 13 through 16

-4.6 -5 -5.3 -7.1

>> T=rot90(rot90(c))

T =

Columns 1 through 4

2.3 5.5 -5.3 -2.3

Columns 5 through 8

-4.6 5.7 1.5 5.5

Columns 9 through 12

-0.2 -4.4 -2.3 -5

Columns 13 through 16

6.8 -7.1 6.8 3.5

>> u=[a(2) a(5) a(6)], v=[b(1) b(3) b(5)]

u =

6.8 -5 -2.3

v =

5.5 5.7 -2.3

>> cross(u,v)

ans =

24.61 2.99 66.26

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]