# -*- coding: utf-8 -*-
"""
Created on Thu May 10 10:11:06 2018
@author: Student
"""
from pylab import *
from numpy import *
from matplotlib import *
from scipy import *
def cosinus(a,b,n):
t=linspace(a,b,n)
y=20+sin(2*pi*50*t)
return y
funkcja = cosinus(0,0.1,200)
print(funkcja)
t=linspace(0,0.1,200)
subplot(311)
plt.plot(t,funkcja,'r')
def dct(x):
N=x.shape[0]
y=empty(N)
for k in range (0,N-1):
y[k]=0
for n in range(0,N-1):
y[k]+=x[n]*cos(pi/N*(n+0.5)*float(k))
return y
funkcja1=dct(funkcja)
print(funkcja1)
subplot(312)
plt.plot(t,funkcja1,'r')
def idct(x):
N=x.shape[0]
y=empty(N)
for k in range (0,N-1):
y[k]=0.5*x[0]
for n in range(0,N-1):
y[k]+=x[n]*cos(pi/N*(n+0.5)*float(k))
return y
funkcja2=idct(funkcja)
print(funkcja2)
subplot(313)
plt.plot(t,funkcja2,'r')
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}