Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
1. Моедлирование сигналов / Лабораторная 1. Моделирование сигналов. Агеев.docx
Скачиваний:
0
Добавлен:
16.12.2025
Размер:
73.13 Кб
Скачать

МИНОБРНАУКИ

Федеральное государственное бюджетное

образовательное учреждение высшего образования

«Челябинский государственный университет»

(ФГБОУ ВО «ЧелГУ»)

Кафедра радиофизики и электроники

Лабораторная работа №1

«Моделирование стандартных радиофизических сигналов»

Выполнил:

студент группы ФФ-404

Агеев Алексей

Проверил:

Доцент, Старший научный сотрудник

Павлухина О.О.

Челябинск, 2025 г.

Задание:

Отрисовать:

  1. sin x, cos x, 1 период в интервале от 0 до 2 , амплитуда – 1.

  2. Дельта- и сигма-функции, интервал (0,100)

  3. Радиоимпульс (5 периодов синуса), в интервале (0, 50) – синус, (50,100) – 0

  4. Случайный сигнал в интервале (0, 1), амплитуда – 100

  5. Последовательность прямоугольных импульсов, (0, 25) – 1, (25, 50) – 0 и далее

Синус

#include "stdafx.h"

#include <iostream>

#include <windows.h>

#include <math.h>

#include <fstream>

#include <stdlib.h>

using namespace std;

void Gen_sin(float fun_sin[2][1024])

{

int n, i;

double x;

double pi = 3.14;

cout << "Число точек: ";

cin >> n;

for (int i = 0; i < n; i++)

{

x = (2 * pi / n)*i;

fun_sin[0][i] = x;

fun_sin[1][i] = sin(x);

}

ofstream out;

out.open("sin.txt", ios::binary);

if (!out) {

cout << "Не открыт";

}

for (i = 0; i < n; i++)

{

out << fun_sin[0][i] << ", " << fun_sin[1][i] << "\n";

}

out.close();

}

void main()

{

float fun_sin[2][1024];

Gen_sin(fun_sin);

}

0

0

0,1256

0,12527

0,2512

0,248566

0,3768

0,367947

0,5024

0,48153

0,628

0,587528

0,7536

0,684268

0,8792

0,770229

1,0048

0,844055

1,1304

0,904583

1,256

0,950859

1,3816

0,982156

1,5072

0,997978

1,6328

0,998078

1,7584

0,982454

1,884

0,951351

2,0096

0,905261

2,1352

0,844908

2,2608

0,771244

2,3864

0,685429

2,512

0,588816

2,6376

0,482926

2,7632

0,369427

2,8888

0,250109

3,0144

0,12685

3,14

0,00159265

3,2656

-0,12369

3,3912

-0,247023

3,5168

-0,366465

3,6424

-0,480134

3,768

-0,586238

3,8936

-0,683106

4,0192

-0,769212

4,1448

-0,8432

4,2704

-0,903903

4,396

-0,950365

4,5216

-0,981855

4,6472

-0,997876

4,7728

-0,998176

4,8984

-0,98275

5,024

-0,951841

5,1496

-0,905936

5,2752

-0,845759

5,4008

-0,772256

5,5264

-0,686588

5,652

-0,590102

5,7776

-0,48432

5,9032

-0,370907

6,0288

-0,251651

6,1544

-0,12843

Косинус

#include "stdafx.h"

#include <iostream>

#include <windows.h>

#include <math.h>

#include <fstream>

#include <stdlib.h>

using namespace std;

void Gen_cos(float fun_cos[2][1024])

{

int n, i;

double x;

double pi = 3.14;

cout << "Число точек: ";

cin >> n;

for (int i = 0; i < n; i++)

{

x = (2 * pi / n)*i;

fun_cos[0][i] = x;

fun_cos[1][i] = cos(x);

}

ofstream out;

out.open("cos.txt", ios::binary);

if (!out) {

cout << "Не открыт";

}

for (i = 0; i < n; i++)

{

out << fun_cos[0][i] << ", " << fun_cos[1][i] << "\n";

}

out.close();

}

Void main()

{

float fun_cos[2][1024];

Gen_cos(fun_cos);

}

0

1

0,1256

0,992123

0,2512

0,968615

0,3768

0,929847

0,5024

0,876429

0,628

0,809204

0,7536

0,72923

0,8792

0,637768

1,0048

0,536257

1,1304

0,426298

1,256

0,309623

1,3816

0,18807

1,5072

0,0635535

1,6328

-0,061964

1,7584

-0,186505

1,884

-0,308108

2,0096

-0,424857

2,1352

-0,534912

2,2608

-0,63654

2,3864

-0,72814

2,512

-0,808267

2,6376

-0,875661

2,7632

-0,92926

2,8888

-0,968218

3,0144

-0,991922

3,14

-0,999999

3,2656

-0,992321

3,3912

-0,96901

3,5168

-0,930432

3,6424

-0,877195

3,768

-0,810139

3,8936

-0,730319

4,0192

-0,638993

4,1448

-0,537601

4,2704

-0,427738

4,396

-0,311137

4,5216

-0,189634

4,6472

-0,0651428

4,7728

0,0603743

4,8984

0,18494

5,024

0,306592

5,1496

0,423414

5,2752

0,533566

5,4008

0,635311

5,5264

0,727047

5,652

0,807329

5,7776

0,874891

5,9032

0,92867

6,0288

0,967818

6,1544

0,991719

Дельта-функция

#include "stdafx.h"

#include <iostream>

#include <windows.h>

#include <math.h>

#include <fstream>

#include <stdlib.h>

using namespace std;

void Gen_delta(float fun_delta[2][1024])

{

int n, i;

double x;

double pi = 3.14;

double position;

cout << "Число точек: ";

cin >> n;

cout << "Позиция дельта-функции (0-100): ";

cin >> position;

if (position = 0 || position = 100)

{

cout << "Ошибка: позиция должна быть в интервале (0, 100)" << endl;

return;

}

for (int i = 0; i < n; i++)

{

x = (100.0 / n)*i;

fun_delta[0][i] = x;

if (fabs(x - position) < (100.0/n)*0.1)

{

fun_delta[1][i] = 1.0;

}

else

{

fun_delta[1][i] = 0.0;

}

}

ofstream out;

out.open("delta.txt", ios::binary);

if (!out) {

cout << "Не открыт";

}

for (i = 0; i < n; i++)

{

out << fun_delta[0][i] << ", " << fun_delta[1][i] << "\n";

}

out.close();

}

Соседние файлы в папке 1. Моедлирование сигналов