Fourier tr demo.m

Z Wikiverzity
Skočit na navigaci Skočit na vyhledávání

fourier_tr_demo.m = program generující obrázky pro demonstraci Fourierovy syntézy


# fourier_tr_demo.m = demonstrace Fourierovy transformace - synteza

global img_n;
img_n = 1;
function imgprint()
    global img_n;
    #img_name = sprintf("/home/petr/oct/fourier_tr_demo%02d.svg", img_n);
    #print (img_name, "-dsvg", "-S1024,768");   # SVG 1024x768 pixel
    #img_name = sprintf("/home/petr/oct/fourier_tr_demo%02d.png", img_n);
    img_name = sprintf("/Data60G/www/bf2/slides/biosig2009-10/oct/fourier_tr_demo%02d.png", img_n);
    print (img_name, "-dpng", "-S1024,768");   # PNG 1024x768 pixel
    fflush(1);
    disp(img_name);
#    input("  Hit any key for next img");
#    kbhit();
    img_n++;
endfunction


grid off;
#label off; blbe
#set (0, "defaultlinelinewidth", "remove");
set (0, "defaultaxeslinewidth", 0.1000); hold on;
xlabel ("rad");


hold on;

global x s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 s11 s13 s_1 s_2 s_3 s_4 s_5 s_6 s_7 s_8 s_9 s_10 s_11 s_12 s_13 ss pil x0 x2p;
global c_1 c_2 c_3 c_4 c_5 c_6 c_7 c_8 c_9 c_10 c_11 c_12 c_13;
x = 0:pi/256:2*pi;
s1 = sin(x);
s2 = sin(2*x)/2;
s3 = sin(3*x)/3;
s4 = sin(4*x)/4;
s5 = sin(5*x)/5;
s6 = sin(6*x)/6;
s7 = sin(7*x)/7;
s8 = sin(8*x)/8;
s9 = sin(9*x)/9;
s10 = sin(10*x)/10;
s11 = sin(11*x)/11;
s13 = sin(13*x)/13;
s_1 = sin(x);
s_2 = sin(2*x);
s_3 = sin(3*x);
s_4 = sin(4*x);
s_5 = sin(5*x);
s_6 = sin(6*x);
s_7 = sin(7*x);
s_8 = sin(8*x);
s_9 = sin(9*x);
s_10 = sin(10*x);
s_11 = sin(11*x);
s_12 = sin(12*x);
s_13 = sin(13*x);
c_1 = cos(x);
c_2 = cos(2*x);
c_3 = cos(3*x);
c_4 = cos(4*x);
c_5 = cos(5*x);
c_6 = cos(6*x);
c_7 = cos(7*x);
c_8 = cos(8*x);
c_9 = cos(9*x);
c_10 = cos(10*x);
c_11 = cos(11*x);
c_12 = cos(12*x);
c_13 = cos(13*x);
ss = (pi/4)*sign(sin(x));
pil = (pi/2)*(1-(1/pi)*x);
x0 = 0:0.001:0.001;
x2p = 2*pi-0.001:0.001:2*pi;

function obdelnik()
global x s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 s11 s13 ss;

clf;
set (0, "defaultlinelinewidth", 2.0000); hold on;
plot (x, s1, 'b;sin(x);');                                            imgprint();
plot (x, s3, 'g;(1/3)sin(3x);');                                      imgprint();
set (0, "defaultlinelinewidth", 5.0000); hold on;
plot (x, s1+s3, 'r;sin(x) + (1/3)sin(3x);');                          imgprint();
clf;

set (0, "defaultlinelinewidth", 2.0000); hold on;
plot (x, s1+s3, 'r;sin(x) + (1/3)sin(3x);');                          imgprint();
plot (x, s5, 'g;(1/5)sin(5x);');                                      imgprint();
set (0, "defaultlinelinewidth", 5.0000); hold on;
plot (x, s1+s3+s5, 'b;sin(x) + (1/3)sin(3x) + (1/5)sin(5x);');        imgprint();
clf;

set (0, "defaultlinelinewidth", 2.0000); hold on;
plot (x, s1+s3+s5, 'b;sin(x) + (1/3)sin(3x) + (1/5)sin(5x);');        imgprint();
plot (x, s7, 'g;(1/7)sin(7x);');                                      imgprint();
set (0, "defaultlinelinewidth", 5.0000); hold on;
plot (x, s1+s3+s5+s7, 'r;sin(x) + (1/3)sin(3x) + (1/5)sin(5x) + (1/7)sin(7x;');        imgprint();
clf;

#set (0, "defaultlinelinewidth", 2.0000); hold on;
#plot (x, s1+s3+s5+s7, 'r;sin(x) + (1/3)sin(3x) + (1/5)sin(5x) + (1/7)sin(7x;');        imgprint();
#plot (x, s9, 'g;(1/9)sin(9x);');                                      imgprint();
#set (0, "defaultlinelinewidth", 5.0000); hold on;
#plot (x, s1+s3+s5+s7+s9, 'b;sin(x) + (1/3)sin(3x) + (1/5)sin(5x) + (1/7)sin(7x) + (1/9)sin(9x);');        imgprint();
#clf;

#set (0, "defaultlinelinewidth", 2.0000); hold on;
#plot (x, s1+s3+s5+s7+s9, 'b;sin(x) + (1/3)sin(3x) + (1/5)sin(5x) + (1/7)sin(7x) + (1/9)sin(9x);');        imgprint();
#plot (x, s11, 'g;(1/11)sin(11x);');                                      imgprint();
#set (0, "defaultlinelinewidth", 5.0000); hold on;
#plot (x, s1+s3+s5+s7+s9+s11, 'r;sin(x)+(1/3)sin(3x)+(1/5)sin(5x)+(1/7)sin(7x)+(1/9)sin(9x)+(1/11)sin(11x);');imgprint();
clf;

set (0, "defaultlinelinewidth", 2.0000); hold on;
#plot (x, s1, 'b;sin(x);');                                            imgprint();
#plot (x, s1+s3, 'r;sin(x) + (1/3)sin(3x);');                          imgprint();
#plot (x, s1+s3+s5, 'b;sin(x) + (1/3)sin(3x) + (1/5)sin(5x);');        imgprint();
plot (x, s1+s3+s5+s7, 'r;sin(x) + (1/3)sin(3x) + (1/5)sin(5x) + (1/7)sin(7x;');        imgprint();
plot (x, s1+s3+s5+s7+s9, 'b;sin(x) + (1/3)sin(3x) + (1/5)sin(5x) + (1/7)sin(7x) + (1/9)sin(9x);');        imgprint();
plot (x, s1+s3+s5+s7+s9+s11, 'r;sin(x)+(1/3)sin(3x)+(1/5)sin(5x)+(1/7)sin(7x)+(1/9)sin(9x)+(1/11)sin(11x);');imgprint();
set (0, "defaultlinelinewidth", 5.0000); hold on;
plot (x, s1+s3+s5+s7+s9+s11+s13,
     'b;sin(x)+(1/3)sin(3x)+(1/5)sin(5x)+(1/7)sin(7x)+(1/9)sin(9x)+(1/11)sin(11x)+(1/13)sin(13x);');       imgprint();
set (0, "defaultlinelinewidth", 8.0000); hold on;
plot (x, ss, 'm;obdelnik;');                                          imgprint();

endfunction;

function pila()
global x s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 s11 ss pil x0 x2p;

clf;
set (0, "defaultlinelinewidth", 2.0000); hold on;
plot (x, s1, 'b;sin(x);');                                            imgprint();
plot (x, s2, 'g;(1/2)sin(2x);');                                      imgprint();
set (0, "defaultlinelinewidth", 5.0000); hold on;
plot (x, s1+s2, 'r;sin(x) + (1/2)sin(2x);');                          imgprint();

clf;
set (0, "defaultlinelinewidth", 2.0000); hold on;
plot (x, s1+s2, 'r;sin(x) + (1/2)sin(2x);');                          imgprint();
plot (x, s3, 'g;(1/3)sin(3x);');                                      imgprint();
set (0, "defaultlinelinewidth", 5.0000); hold on;
plot (x, s1+s2+s3, 'b;sin(x) + (1/2)sin(2x) + (1/3)sin(3x);');        imgprint();

clf;
set (0, "defaultlinelinewidth", 2.0000); hold on;
plot (x, s1+s2+s3, 'b;sin(x) + (1/2)sin(2x) + (1/3)sin(3x);');        imgprint();
plot (x, s4, 'g;sin(x) + (1/4)sin(4x);');                          imgprint();
set (0, "defaultlinelinewidth", 5.0000); hold on;
plot (x, s1+s2+s3+s4, 'r;sin(x)+(1/2)sin(2x)+(1/3)sin(3x)(1/4)sin(4x);');        imgprint();

#clf;
#set (0, "defaultlinelinewidth", 2.0000); hold on;
#plot (x, s1+s2+s3+s4, 'r;sin(x)+(1/2)sin(2x)+(1/3)sin(3x)(1/4)sin(4x);');        imgprint();
#plot (x, s5, 'g;(1/5)sin(5x);');                                      imgprint();
#set (0, "defaultlinelinewidth", 5.0000); hold on;
#plot (x, s1+s2+s3+s4+s5, 'b;sin(x)+(1/2)sin(2x)+(1/3)sin(3x)(1/4)sin(4x)+(1/5)sin(5x);');        imgprint();

#clf;
#set (0, "defaultlinelinewidth", 2.0000); hold on;
#plot (x, s1+s2+s3+s4+s5, 'b;sin(x)+(1/2)sin(2x)+(1/3)sin(3x)(1/4)sin(4x)+(1/5)sin(5x);');        imgprint();
#plot (x, s6, 'g;(1/6)sin(6x);');                                      imgprint();
#set (0, "defaultlinelinewidth", 5.0000); hold on;
#plot (x, s1+s2+s3+s4+s5+s6, 'r;sin(x)+(1/2)sin(2x)+(1/3)sin(3x)(1/4)sin(4x)+(1/5)sin(5x)+(1/6)sin(6x);');  imgprint();

#clf;
#set (0, "defaultlinelinewidth", 2.0000); hold on;
#plot (x, s1+s2+s3+s4+s5+s6, 'r;sin(x)+(1/2)sin(2x)+(1/3)sin(3x)(1/4)sin(4x)+(1/5)sin(5x)+(1/6)sin(6x);');  imgprint();
#plot (x, s7, 'g;(1/7)sin(7x);');                                      imgprint();
#set (0, "defaultlinelinewidth", 5.0000); hold on;
#plot (x, s1+s2+s3+s4+s5+s6+s7, 'b;sin(x)+(1/2)sin(2x)+(1/3)sin(3x)(1/4)sin(4x)+(1/5)sin(5x)+(1/6)sin(6x)+(1/7)sin(7x);');
#imgprint();

#clf;
#set (0, "defaultlinelinewidth", 2.0000); hold on;
#plot (x, s1+s2+s3+s4+s5+s6+s7, 'b;sin(x)+(1/2)sin(2x)+(1/3)sin(3x)(1/4)sin(4x)+(1/5)sin(5x)+(1/6)sin(6x)+(1/7)sin(7x);');
#imgprint();
#plot (x, s8, 'g;(1/8)sin(8x);');  imgprint();
#set (0, "defaultlinelinewidth", 5.0000); hold on;
#plot (x, s1+s2+s3+s4+s5+s6+s7+s8,
#      'r;sin(x)+(1/2)sin(2x)+(1/3)sin(3x)(1/4)sin(4x)+(1/5)sin(5x)+(1/6)sin(6x)+(1/7)sin(7x)+(1/8)sin(8x);'); imgprint();
clf;
set (0, "defaultlinelinewidth", 2.0000); hold on;
#plot (x, s1, 'b;sin(x);');                                            imgprint();
#plot (x, s1+s2, 'r;sin(x) + (1/2)sin(2x);');                          imgprint();
#plot (x, s1+s2+s3, 'b;sin(x) + (1/2)sin(2x) + (1/3)sin(3x);');        imgprint();
plot (x, s1+s2+s3+s4, 'r;sin(x)+(1/2)sin(2x)+(1/3)sin(3x)(1/4)sin(4x);');        imgprint();
plot (x, s1+s2+s3+s4+s5, 'b;sin(x)+(1/2)sin(2x)+(1/3)sin(3x)(1/4)sin(4x)+(1/5)sin(5x);');        imgprint();
plot (x, s1+s2+s3+s4+s5+s6, 'r;sin(x)+(1/2)sin(2x)+(1/3)sin(3x)(1/4)sin(4x)+(1/5)sin(5x)+(1/6)sin(6x);');  imgprint();
plot (x, s1+s2+s3+s4+s5+s6+s7, 'b;sin(x)+(1/2)sin(2x)+(1/3)sin(3x)(1/4)sin(4x)+(1/5)sin(5x)+(1/6)sin(6x)+(1/7)sin(7x);');
set (0, "defaultlinelinewidth", 5.0000); hold on;
plot (x, s1+s2+s3+s4+s5+s6+s7+s8,
      'r;sin(x)+(1/2)sin(2x)+(1/3)sin(3x)+(1/4)sin(4x)+(1/5)sin(5x)+(1/6)sin(6x)+(1/7)sin(7x)+(1/8)sin(8x);'); imgprint();
set (0, "defaultlinelinewidth", 8.0000); hold on;
plot (x, pil, 'm;pila;'); plot (x0, (pi/2)*sign(x0), 'm'); plot (x2p, (pi/2)*sign(x2p-2*pi), 'm'); imgprint();

endfunction;

function impulsy()
global x s_1 s_2 s_3 s_4 s_5 s_6 s_7 s_8 s_9 s_10 s_11 s_12 s_13 ss pil x0 x2p;

clf;
set (0, "defaultlinelinewidth", 2.0000); hold on;
plot (x, s_1, 'b;sin(x);');                                            imgprint();
plot (x, s_2, 'g;sin(2x);');                                      imgprint();
set (0, "defaultlinelinewidth", 5.0000); hold on;
plot (x, s_1+s_2, 'r;sin(x) + sin(2x);');                          imgprint();

clf;
set (0, "defaultlinelinewidth", 2.0000); hold on;
plot (x, s_1+s_2, 'r;sin(x) + sin(2x);');                          imgprint();
plot (x, s_3, 'g;sin(3x);');                                      imgprint();
set (0, "defaultlinelinewidth", 5.0000); hold on;
plot (x, s_1+s_2+s_3, 'b;sin(x) + sin(2x) + sin(3x);');        imgprint();

clf;
set (0, "defaultlinelinewidth", 2.0000); hold on;
plot (x, s_1+s_2+s_3, 'b;sin(x) + sin(2x) + sin(3x);');        imgprint();
plot (x, s_4, 'g;sin(x) + sin(4x);');                          imgprint();
set (0, "defaultlinelinewidth", 5.0000); hold on;
plot (x, s_1+s_2+s_3+s_4, 'r;sin(x)+sin(2x)+sin(3x)sin(4x);');        imgprint();

#clf;
#set (0, "defaultlinelinewidth", 2.0000); hold on;
#plot (x, s_1+s_2+s_3+s_4, 'r;sin(x)+sin(2x)+sin(3x)sin(4x);');        imgprint();
#plot (x, s_5, 'g;sin(5x);');                                      imgprint();
#set (0, "defaultlinelinewidth", 5.0000); hold on;
#plot (x, s_1+s_2+s_3+s_4+s_5, 'b;sin(x)+sin(2x)+sin(3x)sin(4x)+sin(5x);');        imgprint();

#clf;
#set (0, "defaultlinelinewidth", 2.0000); hold on;
#plot (x, s_1+s_2+s_3+s_4+s_5, 'b;sin(x)+sin(2x)+sin(3x)+sin(4x)+sin(5x);');        imgprint();
#plot (x, s_6, 'g;sin(6x);');                                      imgprint();
#set (0, "defaultlinelinewidth", 5.0000); hold on;
#plot (x, s_1+s_2+s_3+s_4+s_5+s_6, 'r;sin(x)+sin(2x)+sin(3x)sin(4x)+sin(5x)+sin(6x);');  imgprint();

#clf;
#set (0, "defaultlinelinewidth", 2.0000); hold on;
#plot (x, s_1+s_2+s_3+s_4+s_5+s_6, 'r;sin(x)+sin(2x)+sin(3x)sin(4x)+sin(5x)+sin(6x);');  imgprint();
#plot (x, s_7, 'g;sin(7x);');                                      imgprint();
#set (0, "defaultlinelinewidth", 5.0000); hold on;
#plot (x, s_1+s_2+s_3+s_4+s_5+s_6+s_7, 'b;sin(x)+sin(2x)+sin(3x)sin(4x)+sin(5x)+sin(6x)+sin(7x);');
#imgprint();

#clf;
#set (0, "defaultlinelinewidth", 2.0000); hold on;
#plot (x, s_1+s_2+s_3+s_4+s_5+s_6+s_7, 'b;sin(x)+sin(2x)+sin(3x)sin(4x)+sin(5x)+sin(6x)+sin(7x);');
#imgprint();
#plot (x, s_8, 'g;sin(8x);');  imgprint();
#set (0, "defaultlinelinewidth", 5.0000); hold on;
#plot (x, s_1+s_2+s_3+s_4+s_5+s_6+s_7+s_8,
#      'r;sin(x)+sin(2x)+sin(3x)sin(4x)+sin(5x)+sin(6x)+sin(7x)+sin(8x);'); imgprint();
clf;
set (0, "defaultlinelinewidth", 2.0000); hold on;
#plot (x, s_1, 'b;sin(x);');                                            imgprint();
#plot (x, s_1+s_2, 'r;sin(x) + sin(2x);');                          imgprint();
#plot (x, s_1+s_2+s_3, 'b;sin(x) + sin(2x) + sin(3x);');        imgprint();
plot (x, s_1+s_2+s_3+s_4, 'r;sin(x)+sin(2x)+sin(3x)sin(4x);');        imgprint();
plot (x, s_1+s_2+s_3+s_4+s_5, 'b;sin(x)+sin(2x)+sin(3x)sin(4x)+sin(5x);');        imgprint();
plot (x, s_1+s_2+s_3+s_4+s_5+s_6, 'r;sin(x)+sin(2x)+sin(3x)sin(4x)+sin(5x)+sin(6x);');  imgprint();
plot (x, s_1+s_2+s_3+s_4+s_5+s_6+s_7, 'b;sin(x)+sin(2x)+sin(3x)+sin(4x)+sin(5x)+sin(6x)+sin(7x);');
plot (x, s_1+s_2+s_3+s_4+s_5+s_6+s_7+s_8,
      'r;sin(x)+sin(2x)+sin(3x)+sin(4x)+sin(5x)+sin(6x)+sin(7x)+sin(8x);'); imgprint();
plot (x, s_1+s_2+s_3+s_4+s_5+s_6+s_7+s_8+s_9,
      'b;sin(x)+sin(2x)+sin(3x)+sin(4x)+sin(5x)+sin(6x)+sin(7x)+sin(8x)+sin(9x);'); imgprint();
plot (x, s_1+s_2+s_3+s_4+s_5+s_6+s_7+s_8+s_9+s_10,
      'r;sin(x)+sin(2x)+sin(3x)+sin(4x)+sin(5x)+sin(6x)+sin(7x)+sin(8x)+sin(9x)+sin(10x);'); imgprint();
plot (x, s_1+s_2+s_3+s_4+s_5+s_6+s_7+s_8+s_9+s_10+s_11,
      'b;sin(x)+sin(2x)+sin(3x)+sin(4x)+sin(5x)+sin(6x)+sin(7x)+sin(8x)+sin(9x)+sin(10x)+sin(11x);'); imgprint();
plot (x, s_1+s_2+s_3+s_4+s_5+s_6+s_7+s_8+s_9+s_10+s_11+s_12,
      'r;sin(x)+sin(2x)+sin(3x)+sin(4x)+sin(5x)+sin(6x)+sin(7x)+sin(8x)+sin(9x)+sin(10x)+sin(11x)+sin(12x);'); imgprint();
set (0, "defaultlinelinewidth", 5.0000); hold on;
plot (x, s_1+s_2+s_3+s_4+s_5+s_6+s_7+s_8+s_9+s_10+s_11+s_12+s_13,
      'b;sin(x)+sin(2x)+sin(3x)+sin(4x)+sin(5x)+sin(6x)+sin(7x)+sin(8x)+sin(9x)+sin(10x)+sin(11x)+sin(12x)+sin(13x);');
     imgprint();
set (0, "defaultlinelinewidth", 8.0000); hold on;
plot (x, 0*x, 'm;impulsy;'); plot (x0, 15*sign(x0), 'm');  plot (x2p, 15*sign(x2p-2*pi), 'm'); imgprint();

endfunction;


function dirac()
global x c_1 c_2 c_3 c_4 c_5 c_6 c_7 c_8 c_9 c_10 c_11 c_12 c_13 ss pil x0 x2p;

clf;
set (0, "defaultlinelinewidth", 2.0000); hold on;
plot (x, c_1, 'b;cos(x);');                                            imgprint();
plot (x, c_2, 'g;cos(2x);');                                      imgprint();
set (0, "defaultlinelinewidth", 5.0000); hold on;
plot (x, c_1+c_2, 'r;cos(x) + cos(2x);');                          imgprint();

clf;
set (0, "defaultlinelinewidth", 2.0000); hold on;
plot (x, c_1+c_2, 'r;cos(x) + cos(2x);');                          imgprint();
plot (x, c_3, 'g;cos(3x);');                                      imgprint();
set (0, "defaultlinelinewidth", 5.0000); hold on;
plot (x, c_1+c_2+c_3, 'b;cos(x) + cos(2x) + cos(3x);');        imgprint();

clf;
set (0, "defaultlinelinewidth", 2.0000); hold on;
plot (x, c_1+c_2+c_3, 'b;cos(x) + cos(2x) + cos(3x);');        imgprint();
plot (x, c_4, 'g;cos(x) + cos(4x);');                          imgprint();
set (0, "defaultlinelinewidth", 5.0000); hold on;
plot (x, c_1+c_2+c_3+c_4, 'r;cos(x)+cos(2x)+cos(3x)cos(4x);');        imgprint();

#clf;
#set (0, "defaultlinelinewidth", 2.0000); hold on;
#plot (x, c_1+c_2+c_3+c_4, 'r;cos(x)+cos(2x)+cos(3x)cos(4x);');        imgprint();
#plot (x, c_5, 'g;cos(5x);');                                      imgprint();
#set (0, "defaultlinelinewidth", 5.0000); hold on;
#plot (x, c_1+c_2+c_3+c_4+c_5, 'b;cos(x)+cos(2x)+cos(3x)cos(4x)+cos(5x);');        imgprint();

#clf;
#set (0, "defaultlinelinewidth", 2.0000); hold on;
#plot (x, c_1+c_2+c_3+c_4+c_5, 'b;cos(x)+cos(2x)+cos(3x)+cos(4x)+cos(5x);');        imgprint();
#plot (x, c_6, 'g;cos(6x);');                                      imgprint();
#set (0, "defaultlinelinewidth", 5.0000); hold on;
#plot (x, c_1+c_2+c_3+c_4+c_5+c_6, 'r;cos(x)+cos(2x)+cos(3x)cos(4x)+cos(5x)+cos(6x);');  imgprint();

#clf;
#set (0, "defaultlinelinewidth", 2.0000); hold on;
#plot (x, c_1+c_2+c_3+c_4+c_5+c_6, 'r;cos(x)+cos(2x)+cos(3x)cos(4x)+cos(5x)+cos(6x);');  imgprint();
#plot (x, c_7, 'g;cos(7x);');                                      imgprint();
#set (0, "defaultlinelinewidth", 5.0000); hold on;
#plot (x, c_1+c_2+c_3+c_4+c_5+c_6+c_7, 'b;cos(x)+cos(2x)+cos(3x)cos(4x)+cos(5x)+cos(6x)+cos(7x);');
#imgprint();

#clf;
#set (0, "defaultlinelinewidth", 2.0000); hold on;
#plot (x, c_1+c_2+c_3+c_4+c_5+c_6+c_7, 'b;cos(x)+cos(2x)+cos(3x)cos(4x)+cos(5x)+cos(6x)+cos(7x);');
#imgprint();
#plot (x, c_8, 'g;cos(8x);');  imgprint();
#set (0, "defaultlinelinewidth", 5.0000); hold on;
#plot (x, c_1+c_2+c_3+c_4+c_5+c_6+c_7+c_8,
#      'r;cos(x)+cos(2x)+cos(3x)cos(4x)+cos(5x)+cos(6x)+cos(7x)+cos(8x);'); imgprint();
clf;
set (0, "defaultlinelinewidth", 2.0000); hold on;
#plot (x, c_1, 'b;cos(x);');                                            imgprint();
#plot (x, c_1+c_2, 'r;cos(x) + cos(2x);');                          imgprint();
#plot (x, c_1+c_2+c_3, 'b;cos(x) + cos(2x) + cos(3x);');        imgprint();
plot (x, c_1+c_2+c_3+c_4, 'r;cos(x)+cos(2x)+cos(3x)cos(4x);');        imgprint();
plot (x, c_1+c_2+c_3+c_4+c_5, 'b;cos(x)+cos(2x)+cos(3x)cos(4x)+cos(5x);');        imgprint();
plot (x, c_1+c_2+c_3+c_4+c_5+c_6, 'r;cos(x)+cos(2x)+cos(3x)cos(4x)+cos(5x)+cos(6x);');  imgprint();
plot (x, c_1+c_2+c_3+c_4+c_5+c_6+c_7, 'b;cos(x)+cos(2x)+cos(3x)+cos(4x)+cos(5x)+cos(6x)+cos(7x);');
plot (x, c_1+c_2+c_3+c_4+c_5+c_6+c_7+c_8,
      'r;cos(x)+cos(2x)+cos(3x)+cos(4x)+cos(5x)+cos(6x)+cos(7x)+cos(8x);'); imgprint();
plot (x, c_1+c_2+c_3+c_4+c_5+c_6+c_7+c_8+c_9,
      'b;cos(x)+cos(2x)+cos(3x)+cos(4x)+cos(5x)+cos(6x)+cos(7x)+cos(8x)+cos(9x);'); imgprint();
plot (x, c_1+c_2+c_3+c_4+c_5+c_6+c_7+c_8+c_9+c_10,
      'r;cos(x)+cos(2x)+cos(3x)+cos(4x)+cos(5x)+cos(6x)+cos(7x)+cos(8x)+cos(9x)+cos(10x);'); imgprint();
plot (x, c_1+c_2+c_3+c_4+c_5+c_6+c_7+c_8+c_9+c_10+c_11,
      'b;cos(x)+cos(2x)+cos(3x)+cos(4x)+cos(5x)+cos(6x)+cos(7x)+cos(8x)+cos(9x)+cos(10x)+cos(11x);'); imgprint();
plot (x, c_1+c_2+c_3+c_4+c_5+c_6+c_7+c_8+c_9+c_10+c_11+c_12,
      'r;cos(x)+cos(2x)+cos(3x)+cos(4x)+cos(5x)+cos(6x)+cos(7x)+cos(8x)+cos(9x)+cos(10x)+cos(11x)+cos(12x);'); imgprint();
set (0, "defaultlinelinewidth", 5.0000); hold on;
plot (x, c_1+c_2+c_3+c_4+c_5+c_6+c_7+c_8+c_9+c_10+c_11+c_12+c_13,
      'b;cos(x)+cos(2x)+cos(3x)+cos(4x)+cos(5x)+cos(6x)+cos(7x)+cos(8x)+cos(9x)+cos(10x)+cos(11x)+cos(12x)+cos(13x);');
     imgprint();
set (0, "defaultlinelinewidth", 8.0000); hold on;
plot (x, 0*x-0.5, 'm;dirac;'); plot (x0, 15*sign(x0), 'm'); plot (x2p, -15*sign(x2p-2*pi), 'm'); imgprint();

endfunction;

obdelnik();
pila();
impulsy();
dirac();