Skip to content
This repository has been archived by the owner on Dec 26, 2023. It is now read-only.

[task_01] Add solution #269

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions trunk/as0006212/task_01/doc/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<p align="center"> Ministry of education of Belarus</p>
<p align="center">Учреждение образования</p>
<p align="center">“Брестский Государственный технический университет”</p>
<p align="center">Кафедра ИИТ</p>
<br><br><br>
<p align="center">Лабораторная работа №1</p>
<p align="center">По дисциплине “ТМАУ”</p>
<p align="center">Тема: “Моделирования температуры объекта”</p>
<br><br><br>
<p align="right">made by:</p>
<p align="right">student 3 kurs/p>
<p align="right">Group АС-62</p>
<p align="right">Кузько Е.В..</p>
<p align="right">checked by:</p>
<p align="right">Иванюк Д.С.</p>
<br><br><br>
<p align="center">Brest 2023</p>

---
<p> <strong> Goal: </strong>Cоздать прoграмму на языке C++, моделирующую температуру с использованием линейной и нелинейной мат модели.</p>
<p> <strong> Task: </strong> </p>



1. Предварительное задание [#0](../../../../tasks/task_00/readme.md).
2. Основное задание [#1](../../../../tasks/task_01/readme.md).

<p> <strong> Solution </strong> </p>

<p>Запускаем наш проект</p>

<p>Вывод нашей программмы на консоль:

``` bash
Входная начальная температура: 5
Введите значение потепления: 1
для линейной:
y[1] = 5.6
y[2] = 6.32
y[3] = 7.184
y[4] = 8.2208
y[5] = 9.46496
y[6] = 10.958
y[7] = 12.7495
y[8] = 14.8995
y[9] = 17.4793
y[10] = 20.5752
y[11] = 24.2903
y[12] = 28.7483
y[13] = 34.098
y[14] = 40.5176
y[15] = 48.2211
для нелинейной:
y[2] = 9.15171
y[3] = 13.6538
y[4] = 20.4769
y[5] = 30.4655
y[6] = 45.181
y[7] = 66.8351
y[8] = 98.7063
y[9] = 145.613
y[10] = 214.65
y[11] = 316.257
y[12] = 465.8
y[13] = 685.895
y[14] = 1009.83
y[15] = 1486.58

<p> <strong> Вывод:</strong> В ходе выполнения данной лабораторной работы были получены знания для работы с <em>cMake</em>, а так же приобретены навыки работы с <em>git</em> и <em>github</em></p>
5 changes: 5 additions & 0 deletions trunk/as0006212/task_01/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
cmake_minimum_required (VERSION 3.5)

project (task1)

add_executable(task1 lab1.cpp)
34 changes: 34 additions & 0 deletions trunk/as0006212/task_01/src/lab1.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
const int n = 16;
void linear(vector<double>& y, double warm, double coef1, double coef2) {
vector<double> newTemp(n);
for (int i = 1; i < n; i++) {
y[i] = coef1 * y[i - 1] + coef2 * warm;
newTemp[i] = y[i];
}
cout << "для линейной:\n";
for (int i = 1; i < n; i++) cout << "y[" << i << "] = " << newTemp[i] << " \n";
}
void nonLinear(vector<double>& y, double warm, double coef1, double coef2, double coef3, double coef4) {
vector<double> newTemp(n);
for (int i = 2; i < n; i++) {
y[i] = coef1 * y[i - 1] - coef2 * y[i - 2] + coef3 * warm + coef4 * sin(warm);
newTemp[i] = y[i];
}
cout << "для нелинейной:\n";
for (int i = 2; i < n; i++) cout << "y[" << i << "] = " << newTemp[i] << " \n";
}
int main() {
setlocale(LC_ALL, "Russian");
double coef1 = 1.2, coef2 = -0.4, coef3 = 0.6, coef4 = -0.2, warm;
vector<double> y(n);
cout << "Входная начальная температура: ";
cin >> y[0];
cout << "Введите значение потепления: ";
cin >> warm;
linear(y, warm, coef1, coef2);
nonLinear(y, warm, coef1, coef2, coef3, coef4);
}
Loading