Axborot texnologiyalari va kommunikatsiyalarini rivojlantirish vazirligi muso al-xorazmiy nomidagi
Download 319.67 Kb. Pdf ko'rish
|
Amaliy ish 1 - Azimov Sarvarbek 203-18
- Bu sahifa navigatsiya:
- Multimediya texnologiyalari kafedrasi Machine Learning fanidan
- Mavzu: Chiziqli funksiyalar qurish
- TOSHKENT - 2018 1-amaliy ish Mavzu
- Chiziqli funksiyani vizuallashtirish dasturi , python
AXBOROT TEXNOLOGIYALARI VA KOMMUNIKATSIYALARINI RIVOJLANTIRISH VAZIRLIGI MUSO AL-XORAZMIY NOMIDAGI TOSHKENT AXBOROT TEXNOLOGIYALARI UNIVERSITETI Multimediya texnologiyalari kafedrasi Machine Learning fanidan AMALIY ISH №1 Mavzu: Chiziqli funksiyalar qurish Bajardi: 203/18-guruh talabasi Azimov S. Tekshirdi: Artikova M. TOSHKENT - 2018 1-amaliy ish Mavzu: Chiziqli funksiyalarni amaliy dasturlash muhiti yordamida vizual tasvirlash
1. Amaliy ishni bajarish uchun sin(x) funksiya tanlab olindi. 2. Kompyuter ekranida koordinatalar boshi yuqori chap burchak ekanligini inobatga olib, quyidagi o’zgaruvchilarni kiritib olamiz: w ~ siklik chastota,
sinov qiymati: 0.0209 phi ~ grafikning X bo'yicha siljishi, sinov qiymati: 20 A ~ amplituda,
sinov qiymati: 200 dy ~ grafikning Y bo'yicha siljishi, sinov qiymati: 320 3. Chiziqli funksiyani vizuallashtirish dasturi, python dasturlash tilida: *******main.py******** from tkinter import * import math
root = Tk() root.title("Machine Learning - Practice 1") root.geometry('1320x640')
canvas = Canvas(root, width=1040, height=640, bg='#002') canvas.pack(side='right')
#vertikal to'r chiziqlari for y in range(21): k = 50 * y canvas.create_line(20+k, 620, 20+k, 20, width=1, fill='#191938')
#gorizontal to'r chiziqlari for x in range(13): k = 50 * x canvas.create_line(20, 20+k, 1020, 20+k, width=1, fill='#191938')
#X va Y chiziqlari canvas.create_line(20, 20, 20, 620, width=1, arrow=FIRST, fill='white') canvas.create_line(10, 320, 1020, 320, width=1, arrow=LAST, fill='white') canvas.create_text(20, 10, text='300', fill='white') canvas.create_text(20, 630, text='-300', fill='white') canvas.create_text(10, 310, text='0', fill='white') canvas.create_text(1030, 310, text='1000', fill='white')
label_w = Label(root, text='Siklik chastota:') label_w.place(x=10, y=10) label_phi = Label(root, text='X bo\'yicha siljish:') label_phi.place(x=10, y=30) label_A = Label(root, text='Amplituda:') label_A.place(x=10, y=50) label_dy = Label(root, text='Y bo\'yicha siljish:') label_dy.place(x=10, y=70)
entry_w = Entry(root) entry_w.place(x=120, y=10) entry_phi = Entry(root) entry_phi.place(x=120, y=30) entry_A = Entry(root) entry_A.place(x=120, y=50) entry_dy = Entry(root) entry_dy.place(x=120, y=70)
def sinus(w, phi, A, dy): global sin sin = 0 xy = [] for x in range(1000): y = math.sin(x * w) xy.append(x + phi) xy.append(y * A + dy) sin = canvas.create_line(xy, fill='blue')
def clean(): canvas.delete(sin)
btn_calc = Button(root, text='Chizish') btn_calc.bind(' float(entry_phi.get()), float(entry_A.get()), float(entry_dy.get()))) btn_calc.place(x=10, y=100)
btn_clean = Button(root, text='Tozalash') btn_clean.bind(' btn_clean.place(x=100, y=100)
root.mainloop() ******************** 4. Dasturni ishga tushiramiz (Ctrl+F10):
5. Endi sinov qiymatlarini kiritamiz: 6. Chizish tugmasini bosamiz:
7. Tozalash ni bosamiz va kiruvchi qiymatlarni biroz o’zgartirib grafik chizamiz:
Ushbu amaliy ishda chiziqli funksiyalarni vizuallashtirish masalasi sin(x) funksiya misolida, python dasturlash tilida o’rganildi.
Download 319.67 Kb. Do'stlaringiz bilan baham: |
ma'muriyatiga murojaat qiling