MUHAMMAD AL-XORAZMIY NOMIDAGI
TOSHKENT AXBOROT-TEXNOLOGIYARI
UNIVERSITETI
CAL004-L1 GURUH TALABASI
HAMROYEV LAZIZNING
ALGORITM LOYIHALASH FANIDAN
BAJARGAN 3-LABARATORIYA ISHI
3-Laboratoriya topshirig‘i
Raqamli axborotlarni qayta ishlash va spektral tahlil qilishda Furye usuli topshiriq bandlari:
1. Berilgan jadval asosida raqamli axborotlar uchun Furye koeffisientlari hisoblansin 0 1 1 10 10 ( , , ,..., , ) A A B A B .
2. Har bir garmonika amplitudalarini hisoblab 2 2 C A B n n n ularni taqqoslash asosida etakchi garmonikalari topilsin.
3. Etakchi garmonikalar uchun ampliuda, chastota va boshlang’ich siljish burchaklari aniqlansin.
4. Tuzilgan model bo’yicha aniqlangan qiymatlar bilan jadval qiymatlar orasidagi farqlar hisoblansin, shunga ko’ra signal tarkibida bo’lishi mumkin bo’lgan shovqinning signalga nisbatan foizi hisoblansin.
Saqalash muddati
Eslatma jadval qiymatlari:
10-VARIANT
Dastur kodi:
class TABLE:
def __init__(self,jadval):
self.j = jadval
def showtable(self,row=0,column=0):
b = " "
p = "+"
c = "|"
m = "-"
max_uslar=[]
#CHANGE TYPE AND ADD ID
for satr in range(len(self.j)):
""""ID"""
# idd = satr+1
# self.j[satr].insert(0,str(idd))
for ustun in range(len(self.j[satr])):
self.j[satr][ustun]=str(self.j[satr][ustun])
#MAXLEN
for ustun in range(len(self.j[1])):
us = []
for satr in range(len(self.j)):
e = len(self.j[satr][ustun])
us.append(e)
max_us = max(us)
max_uslar.append(max_us)
if row == 0 and column == 0:
#1-LINE
print(p,end="")
for ch in range(len(self.j[0])):
bj=(max_uslar[ch]+2)*m
print(f"{bj}",end=p)
print("")
#MAIN
for satr in range(len(self.j)):
for ustun in range(len(self.j[satr])):
bj=(max_uslar[ustun]-len(self.j[satr][ustun]))*b
print(f"{c} {bj}{self.j[satr][ustun]} ",end="")
print(c)
# AJRATISH
print(p,end="")
for ch in range(len(self.j[0])):
bj=(max_uslar[ch]+2)*m
print(f"{bj}",end=p)
print("")
elif row == 1 and column == 0:
print(p,end="")
for ch in range(len(self.j[0])):
bj=(max_uslar[ch]+2)*m
print(f"{bj}",end=p)
print("")
for satr in range(1):
for ustun in range(len(self.j[satr])):
bj=(max_uslar[ustun]-len(self.j[satr][ustun]))*b
print(f"{c} {bj}{self.j[satr][ustun]} ",end="")
print(c)
print(p,end="")
for ch in range(len(self.j[0])):
bj=(max_uslar[ch]+2)*m
print(f"{bj}",end=p)
print("")
for satr in range(len(self.j)):
if satr == 0:
continue
for ustun in range(len(self.j[satr])):
bj=(max_uslar[ustun]-len(self.j[satr][ustun]))*b
print(f"{c} {bj}{self.j[satr][ustun]} ",end="")
print(c)
print(p,end="")
for ch in range(len(self.j[0])):
bj=(max_uslar[ch]+2)*m
print(f"{bj}",end=p)
print("")
if row == 0 and column == 1:
print(p,end="")
for ch in range(len(self.j[0])):
bj=(max_uslar[ch]+2)*m
print(f"{bj}",end=p)
print("")
for satr in range(1):
for ustun in range(len(self.j[satr])):
bj=(max_uslar[ustun]-len(self.j[satr][ustun]))*b
print(f"{c} {bj}{self.j[satr][ustun]} ",end="")
print(c)
for satr in range(len(self.j)):
if satr == 0:
continue
for ustun in range(len(self.j[satr])):
bj=(max_uslar[ustun]-len(self.j[satr][ustun]))*b
print(f"{c} {bj}{self.j[satr][ustun]} ",end="")
print(c)
print(p,end="")
for ch in range(len(self.j[0])):
bj=(max_uslar[ch]+2)*m
print(f"{bj}",end=p)
print("")
""""DELL ID"""
# for satr in range(len(self.j)):
# del self.j[satr][0]
def sumcolumn(self,n,nom=0):
if nom == 0:
for satr in range(len(self.j)):
if satr == 0:
continue
else:
self.j[satr][n-1] = float(self.j[satr][n-1])
s = 0
for satr in range(len(self.j)):
if satr == 0:
continue
else:
s = s + self.j[satr][n-1]
for satr in range(len(self.j)):
if satr == 0:
continue
else:
self.j[satr][n-1] = str(self.j[satr][n-1])
elif nom == 1:
for satr in range(len(self.j)):
self.j[satr][n-1] = float(self.j[satr][n-1])
s = 0
for satr in range(len(self.j)):
s = s + self.j[satr][n-1]
for satr in range(len(self.j)):
self.j[satr][n-1] = str(self.j[satr][n-1])
return s
def sumrow(self,n,nom = 0):
if nom == 0:
for ustun in range(len(self.j[n-1])):
if ustun == 0:
continue
else:
self.j[n-1][ustun] = float(self.j[n-1][ustun])
s = 0
for ustun in range(len(self.j[n-1])):
if ustun == 0:
continue
else:
s = s + self.j[n-1][ustun]
for ustun in range(len(self.j[n-1])):
if ustun == 0:
continue
else:
self.j[n-1][ustun] = str(self.j[n-1][ustun])
elif nom == 1:
for ustun in range(len(self.j[n-1])):
self.j[n-1][ustun] = float(self.j[n-1][ustun])
s = 0
for ustun in range(len(self.j[n-1])):
s = s + self.j[n-1][ustun]
for ustun in range(len(self.j[n-1])):
self.j[n-1][ustun] = str(self.j[n-1][ustun])
return s
def addcolumn(self,n):
for satr in range(len(self.j)):
self.j[satr].insert(n-1,"None")
def delcolumn(self,m):
for satr in range(len(self.j)):
del self.j[satr][m-1]
def addrow(self,n):
u = []
for ustun in range(len(self.j[0])):
e = "None"
u.append(e)
self.j.insert(n,u)
def delrow(self,n):
del self.j[n]
def reverse(self):
v = []
for ustun in range(len(self.j[0])):
s = []
for satr in range(len(self.j)):
s.append(self.j[satr][ustun])
v.append(s)
del self.j[:]
for satr in range(len(v)):
self.j.append(v[satr])
def value(self,satr,ustun,value):
self.j[satr][ustun-1] = value
from math import sin,cos,sqrt
n=21
xi = [0,
4.8e-06,
9.6e-06,
1.44e-05,
1.92e-05,
2.4e-05,
2.88e-05,
3.36e-05,
3.84e-05,
4.32e-05,
4.8e-05,
5.28e-05,
5.76e-05,
6.24e-05,
6.72e-05,
7.2e-05,
7.68e-05,
8.16e-05,
8.64e-05,
9.12e-05,
9.6e-05
]
fi = [
4.13,
6.93269,
3.96504,
-2.32344,
-6.74547,
-5.6525,
0.0572734,
5.67943,
6.58179,
2.0233,
-4.235,
-7.03069,
-4.05605,
2.23944,
6.66847,
5.5825,
-0.120277,
-5.73544,
-6.63079,
-2.0653,
4.2]
ren = list(range(1,22))
nom = ["No","Xi","Fi"]
al = [ren,xi,fi]
alt = TABLE(al)
alt.reverse()
alt.addrow(0)
for n in range(len(nom)):
alt.value(0,n+1,nom[n])
alt.showtable(1,0)
min_x=min(xi)
max_x=max(xi)
d=sum(fi)
#A
ai=[]
a0=(min_x/max_x)*((fi[0]+fi[-1])/2+d)
ai.append(a0)
for i in range(1,11):
d=0
for j in range(1,n):
d=fi[j]*(sin(2*3.14*i*(xi[j]+min_x/2)/max_x)-sin(2*3.14*i*(xi[j]-min_x/2)/max_x))+d
a=1/(3.14*i)*(fi[0]*sin(3.14*i*min_x/max_x)-fi[i]*sin(2*3.14*i*(max_x-min_x/2)/max_x)+d)
ai.append(a)
# for t in range(len(ai)):
# print(f" a{t} = {ai[t]}")
# print("\n")
#B
bi=[]
for i in range(1,11):
d=0
for j in range(1,n):
d=fi[j]*(cos(2*3.14*i*(xi[j]+min_x/2)/max_x)-cos(2*3.14*i*(xi[j]-min_x/2)/max_x))+d
b=1/(3.14*i)*(fi[0]*(1-cos(3.14*i*min_x/(2*max_x)))-fi[i]*(1-cos(2*3.14*i*(max_x-min_x/2)/max_x))-d);
bi.append(b)
# for t in range(len(bi)):
# print(f" b{t+1} = {bi[t]}")
# print("\n")
#C
ci=[]
for i in range(10):
c=sqrt(ai[i]*ai[i]+bi[i]*bi[i])
ci.append(c)
# for t in range(len(ci)):
# print(f" c{t+1} = {ci[t]}")
ai2 = ai[:]
bi2 = bi[:]
ci2 = ci[:]
ren2 = list(range(1,len(ai)+1))
bi2.insert(0, " ")
ci2.insert(0, " ")
nom2 = ["No","Ai","Bi","Ci"]
abct = [ren2,ai2,bi2,ci2]
abc = TABLE(abct)
abc.reverse()
abc.addrow(0)
for n in range(len(nom2)):
abc.value(0,n+1,nom2[n])
abc.showtable(1,0)
#QIYMATLAR
max_c=max(ci)
print(f"\n Yetakchi amplituda = {max_c}")
for c in range(len(ci)):
if max_c==ci[c]:
m=c
w=m/max_x
print(f" Chastota = {w}")
sin_f=ai[m]/ci[m]
cos_f=bi[m]/ci[m]
print(f" sin_f = {sin_f}")
print(f" cos_f = {cos_f}")
Dastur natijasi:
A,B,C KOEFFITSIENTLAR:
YAKUNIY NATIJALAR:
Do'stlaringiz bilan baham: |