Files
it-labs/ТЕМА1/report.md

13 KiB

# Отчет по теме 1

Иванов Владимир, А-03-24

## 1. Изучение среды GNU Octave

Запущена среда GNU Octave. Визуально изучены компоненты графического интерфейса: главное меню, командное окно, окно текущей папки, область переменных и другие элементы.

## 2. Настройка текущего каталога

Нажал на окно рядом с *Текущая папка:* и установил путь к папке ТЕМА1:

![Скриншот выбора текущей папки](assets/screen2.png)

## 3. Настройка окон интерфейса

В главном меню «Окно» отмечены галочками для отображения:

- Командное окно

- Журнал выполненных команд

- Диспетчер файлов

- Область переменных

- Редактор

Все указанные окна появились в интерфейсе среды:

![Скриншот выбора текущей папки](assets/screen3.png)

## 4. Установка путей и работа с файлами

В меню «Правка» + «Установить путь» добавлены пути к папкам TEMA1 и TEMA2. В окне «Диспетчер файлов» отображен список файлов текущей папки.

![Скриншот выбора текущей папки](assets/screen4.png)

## 5. Работа со справкой

Изучена система помощи:

- Открыта документация через «Справка» + «Документация» + «На диске»

- Просмотрен GNU Octave Manual

- Проверен список пакетов через «Справка» + «Пакеты Octave»

- Использована команда help для получения справки по функциям


>> help randn

'randn' is a built-in function from the file libinterp/corefcn/rand.cc



 -- X = randn (N)

 -- X = randn (M, N, ...)

 -- X = randn (\[M N ...])

 -- X = randn (..., "single")

 -- X = randn (..., "double")

 -- V = randn ("state")

 -- randn ("state", V)

 -- randn ("state", "reset")

 -- V = randn ("seed")

 -- randn ("seed", V)

 -- randn ("seed", "reset")

     Return a matrix with normally distributed random elements having

     zero mean and variance one.



     The arguments are handled the same as the arguments for 'rand'.



     By default, 'randn' uses the Marsaglia and Tsang "Ziggurat

     technique" to transform from a uniform to a normal distribution.



     The class of the value returned can be controlled by a trailing

     "double" or "single" argument.  These are the only valid classes.



     Reference: G. Marsaglia and W.W. Tsang, 'Ziggurat Method for

     Generating Random Variables', J. Statistical Software, vol 5, 2000,

&nbsp;    <https://www.jstatsoft.org/v05/i08/>



&nbsp;    See also: rand, rande, randg, randp.



Additional help for built-in functions and operators is

available in the online version of the manual.  Use the command

'doc <topic>' to search the manual index.



Help and information about Octave is also available on the WWW

at https://www.octave.org and via the help@octave.org

mailing list.

## 6. Создание матриц и векторов


&nbsp;                                                                                                                        

>> A=randn(4,6)

A =



&nbsp;  2.4612e-01   7.9905e-01  -1.4302e+00   9.8938e-01  -1.3819e+00   3.0817e-01

&nbsp;  1.8829e-01  -3.0384e-01   1.1265e-01  -3.8922e-01   1.2091e+00   9.9878e-01

&nbsp;  1.1250e+00   8.1922e-03  -3.4760e-01  -1.7645e-01   1.4822e+00  -6.6142e-01

&nbsp; -1.1914e+00   6.5954e-01   4.6774e-01   6.1055e-01  -1.1570e-01   2.6481e-01



>> B=rand(4,7)

B =



&nbsp;  9.1792e-01   4.7319e-01   7.1987e-01   3.8881e-03   1.3237e-01   8.1624e-01   7.8614e-01

&nbsp;  5.9485e-01   3.2186e-01   1.2345e-01   5.9882e-01   7.8491e-01   8.5624e-01   2.3900e-01

&nbsp;  1.0401e-01   5.9963e-01   7.2110e-01   5.5133e-01   2.4909e-01   3.9099e-01   3.0140e-01

&nbsp;  2.3272e-01   2.7837e-01   2.0293e-01   4.8828e-01   2.5064e-01   8.6337e-01   6.8343e-01



>> C = 4:27

C =



&nbsp;   4    5    6    7    8    9   10   11   12   13   14   15   16   17   18   19   20   21   22   23   24   25   26   27



>> H='This is a symbols vector'

H = This is a symbols vector

>> L=\[-2+23.1j, 3-5.6j]

L =



&nbsp;  -2.0000 + 23.1000i    3.0000 -  5.6000i

## 7. Операции с матрицами


D=reshape(C,\[],6)

D =



&nbsp;   4    8   12   16   20   24

&nbsp;   5    9   13   17   21   25

&nbsp;   6   10   14   18   22   26

&nbsp;   7   11   15   19   23   27



>> E=B'\*A

E =



&nbsp; -1.062020  -0.051115   0.074274   1.889323  -0.159865  -0.797471

&nbsp; -0.987574   0.120358   1.538011   1.983992   1.375455  -1.009796

&nbsp; -1.786521   0.544003  -0.841670   2.256538   1.319305  -1.911457

&nbsp; -1.353524  -0.205707  -1.155552   1.282056   0.153180  -1.225409

&nbsp; -1.492714   0.601927  -0.245364   2.303039   1.120912  -1.567984

&nbsp; -0.808763  -0.300447  -1.075886   0.595356  -0.332495  -0.644339

&nbsp; -1.590215   0.232552  -2.454290   1.630394  -0.485993  -1.414100



>> F=\[A,B]



F =



&nbsp;Columns 1 through 5:



&nbsp;  2.4612e-01   7.9905e-01  -1.4302e+00   9.8938e-01  -1.3819e+00

&nbsp;  1.8829e-01  -3.0384e-01   1.1265e-01  -3.8922e-01   1.2091e+00

&nbsp;  1.1250e+00   8.1922e-03  -3.4760e-01  -1.7645e-01   1.4822e+00

&nbsp; -1.1914e+00   6.5954e-01   4.6774e-01   6.1055e-01  -1.1570e-01



&nbsp;Columns 6 through 10:



&nbsp;  3.0817e-01   9.1792e-01   4.7319e-01   7.1987e-01   3.8881e-03

&nbsp;  9.9878e-01   5.9485e-01   3.2186e-01   1.2345e-01   5.9882e-01

&nbsp; -6.6142e-01   1.0401e-01   5.9963e-01   7.2110e-01   5.5133e-01

&nbsp;  2.6481e-01   2.3272e-01   2.7837e-01   2.0293e-01   4.8828e-01



&nbsp;Columns 11 through 13:



&nbsp;  1.3237e-01   8.1624e-01   7.8614e-01

&nbsp;  7.8491e-01   8.5624e-01   2.3900e-01

&nbsp;  2.4909e-01   3.9099e-01   3.0140e-01

&nbsp;  2.5064e-01   8.6337e-01   6.8343e-01



>> G=A.\*D

G =



&nbsp;  -2.1133   -7.9531    5.0795   17.7987  -31.0683    2.7012

&nbsp;  -1.9133    9.9180   20.5493   29.0286   36.1644  -17.3466

&nbsp;  -2.1444   -1.3123    4.7728   -1.3861   30.2171  -15.7074

&nbsp;  -8.9271    1.3795  -49.8654   10.4939  -15.5500  -32.1418



>> M=G./4.5

M =



&nbsp;  -0.4696   -1.7674    1.1288    3.9553   -6.9041    0.6003

&nbsp;  -0.4252    2.2040    4.5665    6.4508    8.0365   -3.8548

&nbsp;  -0.4765   -0.2916    1.0606   -0.3080    6.7149   -3.4905

&nbsp;  -1.9838    0.3065  -11.0812    2.3320   -3.4556   -7.1426



>> DDD=D.^3

DDD =



&nbsp;     64     512    1728    4096    8000   13824

&nbsp;    125     729    2197    4913    9261   15625

&nbsp;    216    1000    2744    5832   10648   17576

&nbsp;    343    1331    3375    6859   12167   19683



>> DL=D>=20

DL =



&nbsp; 0  0  0  0  1  1

&nbsp; 0  0  0  0  1  1

&nbsp; 0  0  0  0  1  1

&nbsp; 0  0  0  0  1  1



>> Dstolb=D(:)

Dstolb =



&nbsp;   4

&nbsp;   5

&nbsp;   6

&nbsp;   7

&nbsp;   8

&nbsp;   9

&nbsp;  10

&nbsp;  11

&nbsp;  12

&nbsp;  13

&nbsp;  14

&nbsp;  15

&nbsp;  16

&nbsp;  17

&nbsp;  18

&nbsp;  19

&nbsp;  20

&nbsp;  21

&nbsp;  22

&nbsp;  23

&nbsp;  24

&nbsp;  25

&nbsp;  26

&nbsp;  27

## 8. Стандартные функции


B1=sqrt(B)

B1 =



&nbsp;  0.830196   0.794780   0.626818   0.701587   0.643416   0.574820   0.588671

&nbsp;  0.743569   0.875002   0.919798   0.514131   0.950974   0.127716   0.642313

&nbsp;  0.372137   0.886932   0.853329   0.795333   0.668526   0.557392   0.051291

&nbsp;  0.585250   0.250013   0.883270   0.775134   0.776123   0.636652   0.989364



>> B2=log(B)

B2 =



&nbsp; -0.372186  -0.459381  -0.934198  -0.708822  -0.881929  -1.107396  -1.059777

&nbsp; -0.592586  -0.267058  -0.167202  -1.330552  -0.100537  -4.115892  -0.885359

&nbsp; -1.976984  -0.239973  -0.317219  -0.457989  -0.805361  -1.168973  -5.940491

&nbsp; -1.071431  -2.772484  -0.248248  -0.509438  -0.506889  -0.903063  -0.021386



>> B3=sin(B)

B3 =



&nbsp;  6.3594e-01   5.9050e-01   3.8287e-01   4.7259e-01   4.0226e-01   3.2444e-01   3.3964e-01

&nbsp;  5.2515e-01   6.9299e-01   7.4865e-01   2.6126e-01   7.8602e-01   1.6311e-02   4.0096e-01

&nbsp;  1.3804e-01   7.0799e-01   6.6551e-01   5.9121e-01   4.3220e-01   3.0571e-01   2.6307e-03

&nbsp;  3.3586e-01   6.2466e-02   7.0340e-01   5.6533e-01   5.6659e-01   3.9432e-01   8.2985e-01



>> k=length(B1)

k = 7

>> nm=size(B1)

nm =



&nbsp;  4   7



>> elem=numel(B1)

elem = 28

>> NN=linspace(11.5,34.1,20)

NN =



&nbsp;Columns 1 through 14:



&nbsp;  11.500   12.689   13.879   15.068   16.258   17.447   18.637   19.826   21.016   22.205   23.395   24.584   25.774   26.963



&nbsp;Columns 15 through 20:



&nbsp;  28.153   29.342   30.532   31.721   32.911   34.100



>> FF=ones(2,4)

FF =



&nbsp;  1   1   1   1

&nbsp;  1   1   1   1



>> GG=zeros(5)

GG =



&nbsp;  0   0   0   0   0

&nbsp;  0   0   0   0   0

&nbsp;  0   0   0   0   0

&nbsp;  0   0   0   0   0

&nbsp;  0   0   0   0   0



>> B1D=diag(B1)

B1D =



&nbsp;  0.8302

&nbsp;  0.8750

&nbsp;  0.8533

&nbsp;  0.7751



>> DB=diag(B1D)

DB =



Diagonal Matrix



&nbsp;  0.8302        0        0        0

&nbsp;       0   0.8750        0        0

&nbsp;       0        0   0.8533        0

&nbsp;       0        0        0   0.7751



>> BS1=sort(B)

BS1 =



&nbsp;  1.3849e-01   6.2507e-02   3.9290e-01   2.6433e-01   4.1398e-01   1.6311e-02   2.6307e-03

&nbsp;  3.4252e-01   6.3167e-01   7.2817e-01   4.9222e-01   4.4693e-01   3.1069e-01   3.4653e-01

&nbsp;  5.5290e-01   7.6563e-01   7.8017e-01   6.0083e-01   6.0237e-01   3.3042e-01   4.1257e-01

&nbsp;  6.8923e-01   7.8665e-01   8.4603e-01   6.3255e-01   9.0435e-01   4.0533e-01   9.7884e-01



>> BS2=sortrows(B,2)

BS2 =



&nbsp;  3.4252e-01   6.2507e-02   7.8017e-01   6.0083e-01   6.0237e-01   4.0533e-01   9.7884e-01

&nbsp;  6.8923e-01   6.3167e-01   3.9290e-01   4.9222e-01   4.1398e-01   3.3042e-01   3.4653e-01

&nbsp;  5.5290e-01   7.6563e-01   8.4603e-01   2.6433e-01   9.0435e-01   1.6311e-02   4.1257e-01

&nbsp;  1.3849e-01   7.8665e-01   7.2817e-01   6.3255e-01   4.4693e-01   3.1069e-01   2.6307e-03



>> DS1=sum(D)

DS1 =



&nbsp;   22    38    54    70    86   102



>> DS2=sum(D,2)

DS2 =



&nbsp;   84

&nbsp;   90

&nbsp;   96

&nbsp;  102



>> DP1=prod(D)

DP1 =



&nbsp;     840     7920    32760    93024   212520   421200



>> dt=det(A\*A')

dt = 727.40

>> dinv=inv(A\*A')

dinv =



&nbsp;  0.283810  -0.061584   0.278944  -0.011754

&nbsp; -0.061584   0.190474  -0.271478   0.037051

&nbsp;  0.278944  -0.271478   0.932179  -0.026774

&nbsp; -0.011754   0.037051  -0.026774   0.076090

## 9. Работа с индексацией элементов матриц


D1=D(3,5)

D1 = 22

>> D2=D(3,4:end)

D2 =



&nbsp;  18   22   26



>> D3=D(2:3,3:5)

D3 =



&nbsp;  13   17   21

&nbsp;  14   18   22



>> D4=D(16:20)

D4 =



&nbsp;  19   20   21   22   23



>> D5=D(3:4,\[1,3,6])

D5 =



&nbsp;   6   14   26

&nbsp;   7   15   27

## 10. Управляющие конструкции


Dsum=0

Dsum = 0

>> for i=1:6

Dsum=Dsum+sqrt(D(2,i))\\

endfor

Dsum = 2.2361

Dsum = 5.2361

Dsum = 8.8416

Dsum = 12.965

Dsum = 17.547

Dsum = 22.547

>> Dsum2=0;i=1

i = 1

>> while (D(i)<22)

Dsum2=Dsum2+sin(D(i))

i=i+1

endwhile

Dsum2 = -0.7568

i = 2

Dsum2 = -1.7157

i = 3

Dsum2 = -1.9951

i = 4

Dsum2 = -1.3382

i = 5

Dsum2 = -0.3488

i = 6

Dsum2 = 0.063321

i = 7

Dsum2 = -0.4807

i = 8

Dsum2 = -1.4807

i = 9

Dsum2 = -2.0173

i = 10

Dsum2 = -1.5971

i = 11

Dsum2 = -0.6065

i = 12

Dsum2 = 0.043799

i = 13

Dsum2 = -0.2441

i = 14

Dsum2 = -1.2055

i = 15

Dsum2 = -1.9565

i = 16

Dsum2 = -1.8066

i = 17

Dsum2 = -0.8937

i = 18

Dsum2 = -0.057011

i = 19

>> if (D(3,5)>=20)

printf('D(3,5)>=20')

else

printf('D(3,5)<20')

endif

D(3,5)>=20>>

## 11. Графические функции


>> graphics\_toolkit('gnuplot')

>> plot(D(1,:),B(\[2,4],1:6))

>>

>> hist(A(:),6)

>>

>>

>> pie(D(1,:))





>> bar(D(1,:))

![график](assets/graphic11.png)

![гистограмма](assets/histogram11.png)

![круговая диаграмма](assets/pie11.png)

![ступенчатая диаграмма](assets/bar11.png)

## 12. Работа с текстовым редактором

Создан файл Prog1.m с командами из пункта 9. Файл сохранен в папке TEMA1/assets. Программа успешно запущена как через клавишу F5, так и через ввод имени файла в командной строке.

## 13. Сохранение и загрузка переменных

Содержимое области переменных сохранено в файл Perem. После перезапуска среды и установки пути к папке TEMA1 переменные успешно загружены из файла Perem. Команды из предыдущего сеанса отображены в журнале выполненных команд.