Ministry of Higher Education, Science and Innovation of the Republic of Uzbekistan



Yüklə 40,4 Kb.
səhifə1/2
tarix07.01.2024
ölçüsü40,4 Kb.
#209874
  1   2


Ministry of Higher Education, Science and Innovation of the Republic of Uzbekistan

Tashkent University of Information Technologies named after Muhammad al-Khorazmi
Assignment 3

Done by: Shobotayev Javlonbek
Received: Xoldorov .Sh.

Tashkent – 2023
Pycharm muhitida signallarga raqamli ishlov berish
Berilgan funktsiyalardan variant tanlanib, olingan variantlar ustida quyidagi amallar bajariladi:

  1. Funksiya uchun Hara o’zgartirishi

2. Nutq signali uchun Hara o’zgartirishi

10.





Shobo‘tayev Javlonbek Bahodir o‘g‘li 424-21

Berilgan funksiya

import numpy as np
import matplotlib.pyplot as plt

# Funksiya


def funksiya(x):
return (x**2 + 1)**np.cos(x)

# Berilgan interval va delta x


x_interval = np.arange(0, 1.01, 0.01)
x_tasvir = np.arange(0, 6.28, 3.14/16)

# Funksiyani hisoblash


y_interval = funksiya(x_interval)
y_tasvir = funksiya(x_tasvir)

# Natijalarni bitta grafikda chiqarish


plt.figure(figsize=(10, 5))

plt.plot(x_interval, y_interval, label='Interval [0, 1]')


plt.plot(x_tasvir, y_tasvir, label='Interval [0, 6.28]')

plt.title('Funksiyaning o\'zgarishi')


plt.xlabel('x')
plt.ylabel('y')
plt.legend()

plt.show()


Berilgan funksiyani o’zgartirish dasturi.

O’zgartirilgandan keyingi grafik tasvir.
Ovozli signalga hara o’zgartirishikiritish

import numpy as np


import matplotlib.pyplot as plt
from scipy.io import wavfile
from scipy.signal import spectrogram

# Funksiyalar


def tasvirlash(signal, fs, label):
time = np.arange(0, len(signal)) / fs
plt.plot(time, signal, label=label)

def audio_spektri(signal, fs, label):


f, t, Sxx = spectrogram(signal, fs)
plt.pcolormesh(t, f, 10 * np.log10(Sxx), label=label)

def amplitudagram(signal, fs, label):


time = np.arange(0, len(signal)) / fs
plt.plot(time, np.abs(signal), label=label)

# Ovozni o'qish


fs, signal = wavfile.read("javlonbek.wav")

# O'zgarmagan holatni tasvirlash


plt.figure(figsize=(15, 5))

plt.subplot(131)


tasvirlash(signal, fs, 'O\'zgarmagan holat')
plt.title('O\'zgarmagan holat')
plt.xlabel('Vaqt (s)')
plt.ylabel('Amplituda')
plt.legend()

plt.subplot(132)


audio_spektri(signal, fs, 'O\'zgarmagan holat')
plt.title('O\'zgarmagan holatning audio spektri')
plt.xlabel('Vaqt (s)')
plt.ylabel('Frekans (Hz)')
plt.legend()

plt.subplot(133)


amplitudagram(signal, fs, 'O\'zgarmagan holat')
plt.title('O\'zgarmagan holatning amplitudagrami')
plt.xlabel('Vaqt (s)')
plt.ylabel('Amplituda')
plt.legend()

plt.tight_layout()


plt.show()

# Ovozni o'zgartirish


# Masalan, ovozni balansini o'zgartirish
signal_changed = signal * 2

# O'zgarmagan holatni tasvirlash


plt.figure(figsize=(15, 5))

plt.subplot(131)


tasvirlash(signal_changed, fs, 'O\'zgarilgan holat')
plt.title('O\'zgarilgan holat')
plt.xlabel('Vaqt (s)')
plt.ylabel('Amplituda')
plt.legend()

plt.subplot(132)


audio_spektri(signal_changed, fs, 'O\'zgarilgan holat')
plt.title('O\'zgarilgan holatning audio spektri')
plt.xlabel('Vaqt (s)')
plt.ylabel('Frekans (Hz)')
plt.legend()

plt.subplot(133)


amplitudagram(signal_changed, fs, 'O\'zgarilgan holat')
plt.title('O\'zgarilgan holatning amplitudagrami')
plt.xlabel('Vaqt (s)')
plt.ylabel('Amplituda')
plt.legend()

plt.tight_layout()


plt.show()
ma’lum ovozli habarga o’zgartiriw kiritish dastur kodi.



Ovozli habar(wav formatida).
O’zgartirish kiritishdan avvalgi holat.

O’zgartirish kiritilganidan keyingi holat.





Yüklə 40,4 Kb.

Dostları ilə paylaş:
  1   2




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©azkurs.org 2024
rəhbərliyinə müraciət

gir | qeydiyyatdan keç
    Ana səhifə


yükləyin