コード例 #1
0
def differentialEquationCustome(x, n):
    print('\n ')
    print('model: Function name that returns derivative values at requested y and t values as dydt=model(y, t)')
    print('y0: Initial conditions of the differential states')
    print('t: Time points at which the solution should be reported. Additional internal points are often calculated to maintain accuracy of the solution but are not reported.')
    pyogclr.print_pass('opening figure . . .')
    print('From : x = ', x)
    print('       n = ', n)
    # initial condition
    # for x(n) = { 1 5 0 3 9 9}
    y0 = x

    # time points
    # arr[0:5]
    t = np.linspace(n[0], n[5])

    # solve ODE
    y = odeint(model, y0, t)

    # plot results
    plt.plot(t, y)

    plt.title('Differential Equation')
    plt.grid(True)
    plt.ylabel('y(t)')
    plt.xlabel('time')

    plt.show()
    yogiAskCustome(x, n)
コード例 #2
0
def nomorTujuhCustome(x,n):
    pyogclr.print_pass('            THIS A BENTUK x(n)-x(n-3) : { with custome value }')
    print('From : x = ', x)
    print('       n = ', n)
    pyogclr.print_pass('opening figure . . .')
    x1 = x[0] - x[0]
    x2 = x[1] - x[1]
    x3 = x[2] - x[2]
    x4 = x[3] - x[3]
    x5 = x[4] - x[4]
    x6 = x[5] - x[5]
    xberubah = x1, x2, x3, x4, x5, x6
    n1 = n[0] - (n[0]-3)
    n2 = n[1] - (n[1]-3)
    n3 = n[2] - (n[2]-3)
    n4 = n[3] - (n[3]-3)
    n5 = n[4] - (n[4]-3)
    n6 = n[5] - (n[5]-3)
    nberubah = n1, n2, n3, n4, n5, n6
    print('Hasil :x = ', xberubah)
    print('       n = ', nberubah)
    # xberubah = -x
    # nberubah = n - 3
    ylabel = 'Graphic Jika x(n)-x(n-3) With Custome'
    grafis(nberubah, xberubah, ylabel)
コード例 #3
0
def nomorLima():
    pyogclr.print_pass('            THIS A BENTUK -x(n-3) :')
    print('From : x = ', x)
    print('       n = ', n)
    pyogclr.print_pass('opening figure . . .')
    x1 = -x[0]
    x2 = -x[1]
    x3 = -x[2]
    x4 = -x[3]
    x5 = -x[4]
    x6 = -x[5]
    xberubah = x1, x2, x3, x4, x5, x6
    n1 = n[0] - 3
    n2 = n[1] - 3
    n3 = n[2] - 3
    n4 = n[3] - 3
    n5 = n[4] - 3
    n6 = n[5] - 3
    nberubah = n1, n2, n3, n4, n5, n6
    print('Hasil :x = ', xberubah)
    print('       n = ', nberubah)
    # xberubah = -x
    # nberubah = n - 3
    ylabel = 'Graphic Jika -x(n-3)'
    grafis(nberubah, xberubah, ylabel)
コード例 #4
0
def start():
    authorName = "Yogi Arif Widodo  | yogithesymbian"
    authorUrl = "image url(https://avatars2.githubusercontent.com/u/28316296?s=400&u=e22e07736450e363997d6eb3534aa184a51c761c&v=4)"
    print(authorName)
    print(authorUrl)
    warna.print_pass("gitkraken")
    footer()
コード例 #5
0
def bentukFxn():
    print('\n\n')
    pyogclr.print_pass('            THIS A BENTUK FUNGSI x(n) :')
    print('\t\t\t x(n) = { d d m m y y }')
    print('\t\t\t x(n) = {', x[0], x[1], x[2], x[3], x[4], x[5], '}')
    print('\n\t\t\t x(n) = { n | ', n[0],
          ' <= n <= ', n[5], ', n bil. bulat }')
    yogiAsk()
コード例 #6
0
def bentukFxnCustome(x, n):
    print('\n\n')
    pyogclr.print_pass(
        '            THIS A BENTUK FUNGSI x(n) :  { with custome value } ')
    print('\t\t\t x(n) = { d d m m y y }')
    print('\t\t\t x(n) = {', x[0], x[1], x[2], x[3], x[4], x[5], '}')
    print('\n\t\t\t x(n) = { n | ', n[0],
          ' <= n <= ', n[5], ', n bil. bulat }')
    yogiAskCustome(x, n)
コード例 #7
0
def tabularForm():
    print('\n\n')
    pyogclr.print_pass('            THIS A TABULAR FORM :')
    print('\t\t WHERE ')
    print('\t\t\t x(n) = { d d m m y y }')
    print('\t\t\t x(n) = {', x[0], x[1], x[2], x[3], x[4], x[5], '}')
    t = PrettyTable(['data', 'value1','value2','value3','value4','value5','value6'])
    t.add_row(['x', x[0], x[1], x[2], x[3], x[4], x[5], ])
    t.add_row(['n', n[0], n[1], n[2], n[3], n[4], n[5], ])
    print (t)
    yogiAsk()
コード例 #8
0
def header():
    warna.print_warn("============================")
    print("""

 _   _ _____    _    ____  _____ ____
| | | | ____|  / \  |  _ \| ____|  _
| |_| |  _|   / _ \ | | | |  _| | |_) |
|  _  | |___ / ___ \| |_| | |___|  _ <
|_| |_|_____/_/   \_\____/|_____|_| \_

    """)
    warna.print_warn("============================")
コード例 #9
0
def yoGrafisBeda():
    pyogclr.print_pass('opening figure grafis beda . . .')
    print('From : x = ', x)
    print('       n = ', n)
    n1 = -n[0]
    n2 = -n[1]
    n3 = -n[2]
    n4 = -n[3]
    n5 = -n[4]
    n6 = -n[5]
    nberubah = n1,n2,n3,n4,n5,n6
    print('hasil :x = ', x)
    print('       n = ', nberubah)
    ylabel = 'Persamaan Beda'
    grafis(nberubah, x, ylabel)
コード例 #10
0
def nomorEnamCustome(x,n):
    pyogclr.print_pass('            THIS A BENTUK -3x(n) : { with custome value }')
    print('From : x = ', x)
    print('       n = ', n)
    pyogclr.print_pass('opening figure . . .')
    minusnya = -3
    x1 = minusnya * x[0]
    x2 = minusnya * x[1]
    x3 = minusnya * x[2]
    x4 = minusnya * x[3]
    x5 = minusnya * x[4]
    x6 = minusnya * x[5]
    xberubah = x1, x2, x3, x4, x5, x6
    print('Hasil :x = ', xberubah)
    print('       n = ', n)
    # xberubah = -x
    # nberubah = n - 3
    ylabel = 'Graphic Jika -3x(n) With Custome'
    grafis(n, xberubah, ylabel)
コード例 #11
0
def yoFourierCustome(x, n):
    pyogclr.print_pass(
        'ref dowload here[matlab]:')
    pyogclr.print_fail(
        'https://github.com/yogithesymbian/python-matlab-data-signal/blob/master/fouriertransform1.m')
    pyogclr.print_fail(
        'https://github.com/yogithesymbian/python-matlab-data-signal/blob/master/fouriertransform.m')
    print('From : n = ', n ,' in n/time/frequency and frequency asli nya')
    pyogclr.print_pass('opening figure . . .')
    # jika ->
    # frequence in n/time/frequency
    # still development i am confusing only this calculation fourier
    w1 = n[0]
    w2 = n[1]  # frequency asli
    w3 = n[2]  # frequency asli
    w4 = n[3]  # frequency asli

    w5 = n[4]
    w6 = n[5]

    N = 1000
    T = 1.0 / 1000
    # n * t = 1
    # start 0 stop 1 num 1000
    t = np.linspace(0, N*T, N)
    y = 1*(np.sin(w1*2*np.pi*t)+np.cos(w2*2*np.pi*t) +
           np.sin(w3 * 2 * np.pi * t) + np.cos(w4 * 2 * np.pi * t) +
           np.sin(w4 * 2 * np.pi * t) + np.cos(w5 * 2 * np.pi * t) +
           np.cos(w5 * 2 * np.pi * t)
           )
    yf = scipy.fftpack.fft(y)
    xf = np.linspace(0.0, 1.0/(2.0*T), N/2)
    plt.subplot(211)
    plt.plot(t, y)
    plt.title('Signal nya')
    plt.subplot(212)
    plt.plot(xf, 2.0/N * np.abs(yf[:N//2]))
    plt.title('Frekuensi nya')
    plt.show()
コード例 #12
0
def footer():
    warna.print_fail("=================================")

    print("""

     _____ ___   ___ _____ _____ ____
|  ___/ _ \ / _ \_   _| ____|  _
| |_ | | | | | | || | |  _| | |_) |
|  _|| |_| | |_| || | | |___|  _ <
|_|   \___/ \___/ |_| |_____|_| \_


    """)
    warna.print_footer("")
    warna.print_fail("=================================")
コード例 #13
0
from color import ColorPrint as warna
import csvlib as my

warna.print_pass("Hello Mr X ....")

# text = input("Masukan Pesan :")
text = "samarinda~~~"
key = 2


def encryption():
    hasilEnc = ""
    for ch in text:
        encrypt = ord(ch) + key
        encrypt = encrypt % 128
        # if encrypt > 126:
        #     encrypt = 32 + encrypt % 127
        hasilEnc = hasilEnc + chr(encrypt)

    print("\nEncryption : ", hasilEnc)
    return hasilEnc


def decryption(text1):
    hasilDec = ""
    for ch in text1:
        decrypt = ord(ch) - key
        decrypt = decrypt % 128
        # if decrypt > 126:
        #     decrypt = 126 - decrypt %127
        hasilDec = hasilDec + chr(decrypt)
コード例 #14
0
from color import ColorPrint as warna

warna.print_fail('Error')
warna.print_bold('bold')
warna.print_info('info')
warna.print_pass('pass')
warna.print_warn('Warn')
warna.print_info("Grafis Runtun Descret")
コード例 #15
0
def ioMenuProg():
    # choose = pyogclr.print_warn('. \t\t\t [*].Choose : ',)
    # inputString = input()

    ioMenu = input('.\n. \t\t\t [*].Choose : ')
    '''
        Action Menu Program
    '''
    if ioMenu == 'dspolnes':
        ioGrafis()
    elif ioMenu == 'reset':
        start()
    elif ioMenu == '1':
        # clearscreen
        yogiClear()
        # banner
        banner()
        # function
        tabularForm()
    elif ioMenu == '2':
        yogiClear()
        banner()
        bentukFxn()
    elif ioMenu == '3':
        yogiClear()
        banner()
        yoGrafis()
        yogiAsk()
    elif ioMenu == '4':
        yogiClear()
        banner()
        yoGrafisBeda()
        yogiAsk()
        # differentialEquation()
    elif ioMenu == '5':
        yogiClear()
        banner()
        nomorLima()
        yogiAsk()
    elif ioMenu == '6':
        yogiClear()
        banner()
        nomorEnam()
        yogiAsk()
    elif ioMenu == '7':
        yogiClear()
        banner()
        nomorTujuh()
        yogiAsk()
    elif ioMenu == '8':
        yogiClear()
        banner()
        yoFourier()
        # y/n [against|exit]
        yogiAsk()
    elif ioMenu == '9':
        yogiClear()
        banner()
        yoTransz()
        yogiAsk()
    elif ioMenu == '10':
        yogiClear()
        banner()
        print('Jika Diketahui sebuah filter H(n) mempunyai persamaan')
        print('H(n) = 4H(n) - H(n-1_ + 3H(n-3) + 4H(n-4) - 5(Hn-3)+2H(n-6)')
        print('Carilah Y(n) yang merupakan hasil konvolusi X(n)*H(n) dan konvolusi')
        print('Circular dari x(n) * H(n)')
        pyogclr.print_pass(
            'ref download here [matlab] :')
        pyogclr.print_warn(
        '\t\thttps://github.com/yogithesymbian/python-matlab-data-signal/blob/master/fouriertransform1.m')
        pyogclr.print_fail('this function doesnt support on python | still development')
        yogiAsk()
    elif ioMenu == '11':
        yogiClear()
        banner()
        print('Qustion : Bagaimana Struktur filter dalam bentuk H(Z)')
        pyogclr.print_pass(
            'ref download here [matlab] :')
        pyogclr.print_warn(
        '\t\thttps://github.com/yogithesymbian/python-matlab-data-signal/blob/master/fouriertransform1.m')
        pyogclr.print_fail('this function doesnt support on python | still development')
        yogiAsk()
    else:
        pyogclr.print_bold('still development choose other menu')
コード例 #16
0
def customizeValue(x, n):
    yogiClear()
    banner()
    pyogclr.print_bold('output will execute with custome')
    print('\t\tnilai x = ', x)
    print('\t\tNilai n = ', n)
    pyogclr.print_info(
        '.  YOU CAN RESET CUSTOMIZE TO DEFAULT with [*] CHOOSE : reset')
    bannerProgram()
    ioMenu = input('.\n. \t\t\t [*].Choose : ')
    '''
        Action Menu Program with direct value { custome dspolnes }
    '''
    if ioMenu == 'dspolnes':
        ioGrafis()
    elif ioMenu == 'reset':
        start()
    elif ioMenu == '1':
        # clearscreen
        yogiClear()
        # banner
        banner()
        # function
        tabularFormCustome(x, n)
    elif ioMenu == '2':
        yogiClear()
        banner()
        bentukFxnCustome(x, n)
    elif ioMenu == '3':
        yogiClear()
        banner()
        yoGrafisCustome(x, n)
        yogiAskCustome(x, n)
    elif ioMenu == '4':
        yogiClear()
        banner()
        # yoGrafisBeda()
        yoGrafisBedaCustome(x, n)
        yogiAskCustome(x, n)
        # differentialEquationCustome(x, n)
    elif ioMenu == '5':
        yogiClear()
        banner()
        nomorLimaCustome(x, n)
        yogiAskCustome(x, n)
    elif ioMenu == '6':
        yogiClear()
        banner()
        nomorEnamCustome(x,n)
        yogiAskCustome(x, n)
    elif ioMenu == '7':
        yogiClear()
        banner()
        nomorTujuhCustome(x,n)
        yogiAskCustome(x, n)
    elif ioMenu == '8':
        yogiClear()
        banner()
        yoFourierCustome(x,n)
        # y/n [against|exit]
        yogiAskCustome(x, n)
    elif ioMenu == '9':
        yogiClear()
        banner()
        yoTransz()
        yogiAskCustome(x, n)
    elif ioMenu == '10':
        yogiClear()
        banner()
        pyogclr.print_fail('this function doesnt support on python | still development')
        yogiAsk()
    elif ioMenu == '11':
        yogiClear()
        banner()
        pyogclr.print_fail('this function doesnt support on python | still development')
        yogiAsk()
    else:
        pyogclr.print_bold('still development choose other menu')
コード例 #17
0
def bannerProgram():
    pyogclr.print_fail('.\n. \t\t\t\t MENU PROGRAM')
    pyogclr.print_warn('.\t\t\t_________________________________')
    pyogclr.print_pass('. \tx(n) dalam runtun diskret dalam bentuk notasi')
    pyogclr.print_fail('. \t\t\t 1. Bentuk Tabular Form')
    pyogclr.print_fail('. \t\t\t 2. fungsi x(n)')
    pyogclr.print_fail('. \t\t\t 3. Grafis')
    pyogclr.print_fail('. \t\t\t 4. Persamaan Beda | Differential Equation\n')
    pyogclr.print_pass('.\n. \tBagaimana bentuk X(n) Baru Jika')
    pyogclr.print_fail('. \t\t\t 5. -x(n-3)')
    pyogclr.print_fail('. \t\t\t 6. -3x(n)')
    pyogclr.print_fail('. \t\t\t 7.  x(n)-x(n-3)\n')
    pyogclr.print_pass('. \tCarilah x(n)')
    pyogclr.print_fail('. \t\t\t 8. Transformasi Fourier ')
    pyogclr.print_fail('. \t\t\t 9. Transformasi Z ')
    pyogclr.print_pass('. \tOther')
    pyogclr.print_fail(
        '. \t\t\t 10. mencari y(n) dari hasil konvolusi choose for more describe bro ')
    pyogclr.print_fail('. \t\t\t 11. Struktur Filter dalam bentuk H(Z) ')
    pyogclr.print_fail('. \t\t\t N. Exit')
コード例 #18
0
def yoTransz():
    pyogclr.print_pass('Z transform doesnt support in python')
    pyogclr.print_pass('so i write that in matlab only , this link')
    pyogclr.print_pass('could you download the file ztransform.m')
    print("x1(n) = { ", x, " }")
    pyogclr.print_bold('JAWAB______')
    pyogclr.print_fail('x1(z)= 1 + 5z^-1 + 3z^-3 + 9z^4 + 9^-5 ROC: Z tidak sama dengan 0')
    hr_yogi()
    print('download here [matlab] visualisasi')
    pyogclr.print_warn(
        'https://github.com/yogithesymbian/python-matlab-data-signal/blob/master/ztransform.m')
    hr_yogi()
    print('@XFAIL\n',
          'def test_Y13():\n',
          # Z[H(t - m T)] => z/[z^m (z - 1)]   (H is the Heaviside (unit step) function)                                                 z
          'raise NotImplementedError("z-transform not supported")\n',


          '@XFAIL\n',
          'def test_Y14():\n',
          # Z[H(t - m T)] => z/[z^m (z - 1)]   (H is the Heaviside (unit step) function)
          'raise NotImplementedError("z-transform not supported")\n'
          )
    pyogclr.print_bold('still development choose other menu')
    print('% % Z transform',
          'clc'
          'close all % close all',
          'clear all % clear all variable',
          'x=[1 5 0 3 9 9]',
          'b=0',

          '% calculating length of an birth of date',
          'n=length(x)',
          'y=sym(z)',
          'for i=1: n',
          'b=b+x(i)*y ^ (1-i)',
          'end',
          'display(b)',
          '% reference at https: // youtu.be/lpBhat9mVho')
コード例 #19
0
def banner():
    hr_yogi()
    pyogclr.print_fail('. THIS PROGRAM HAS DEFAULT VALUE')
    pyogclr.print_info('.  YOU CAN CUSTOMIZE with [*] CHOOSE : dspolnes')
    pyogclr.print_info(
        '.  YOU CAN RESET CUSTOMIZE TO DEFAULT with [*] CHOOSE : reset')
    hr_yogi()
    pyogclr.print_warn(
        'Birt Of Date : 15 march 1999 \t x = { 1 5 0 3 9 9 } \t n = { 0 1 2 3 4 5}')
    pyogclr.print_info(figlet_format('        DSP-Mr-Day     '))
    pyogclr.print_warn(
        'NAME: Yogi Arif Widodo \t\t NIM: 17 615 006 \t CLASS: TI(4A)')
    hr_yogi()
コード例 #20
0
def yoGrafis():
    pyogclr.print_pass('opening figure grafis 1c . . .')
    print('From : x = ', x)
    print('       n = ', n)
    ylabel = 'Grafis Discrete'
    grafis(n, x, ylabel)
コード例 #21
0
def hr_yogi():
    pyogclr.print_info(figlet_format('____________'))
コード例 #22
0
def yoGrafisCustome(x, n):
    pyogclr.print_pass('opening figure grafis 1c . . .{ with custome mode }')
    print('From : x = ', x)
    print('       n = ', n)
    ylabel = 'Grafis Discrete With Custome'
    grafis(n, x, ylabel)