clear all
clc
tic
a = 0.02;
b = 0.02;

% vodorovna strana
x_high = -a/2:0.00000001:a/2;
x_low = -a/2:0.0001:a/2;
y=0;

for k=1:2:11
    y = y + (((-1)^((k-1)/2))*(4/(k*pi))*cos((k*pi*x_high)/a))*(b/2);
end

figure(1)
plot(x_high,y,'LineWidth',3)
grid on
hold on

yy_high=0;
for j=1:2:101
    yy_high = yy_high + (((-1)^((j-1)/2))*(4/(j*pi))*cos((j*pi*x_high)/a))*(b/2);
end
yy_low=0;
for j=1:2:101
    yy_low = yy_low + (((-1)^((j-1)/2))*(4/(j*pi))*cos((j*pi*x_low)/a))*(b/2);
end
yy_low_low=0;
for j=1:2:1001
    yy_low_low = yy_low_low + (((-1)^((j-1)/2))*(4/(j*pi))*cos((j*pi*x_low)/a))*(b/2);
end
plot(x_high,yy_high,'r','LineWidth',3)
plot(x_low,yy_low,'g','LineWidth',1.7)
plot(x_low,yy_low_low,'k','LineWidth',1.7)
grid on
fontsize = 15;
xlabel('y [m]','FontSize',fontsize)
ylabel('z [m]','FontSize',fontsize)
axis([min(x_high)-0.001 max(x_high)+0.001 min(y)-0.001 max(y)+0.003])
set(gca,'FontSize',fontsize)
legend('n=11','n=101','n=1001','n=101')
% %svisla strana
% y = -b/2:0.0001:b/2;
% x=0;
% 
% for k=1:2:9
%     x = x + ((-1)^((k-1)/2))*(4/(k*pi))*cos((k*pi*y)/a);
% end
% 
% figure(1)
% plot(x,y)
% hold on
% 
% xx=0;
% for j=1:2:15001
%     xx = xx + ((-1)^((j-1)/2))*(4/(j*pi))*cos((j*pi*y)/a);
% end
% hold on
% plot(xx,y,'r')
toc
print '-depsc' 'c:/Users/Tomáš Valenta/Škola/Vejška/_bachelory thesis/zprava/obrazky/09_priklad_vykresleni_rady.eps'


figure(2)
plot(x_high,y,'LineWidth',3)
grid on
hold on
plot(x_high,yy_high,'r','LineWidth',3)
plot(x_low,yy_low,'g','LineWidth',2)
plot(x_low,yy_low_low,'k','LineWidth',1.7)
fontsize = 15;
xlabel('y [m]','FontSize',fontsize)
ylabel('z [m]','FontSize',fontsize)
axis([min(x_high)-0.001 max(x_high)+0.001 min(y)-0.001 max(y)+0.003])
set(gca,'FontSize',fontsize,'XLim',[-0.0101 -0.0085],'YLim',[0.008 0.0125])
legend('n=11','n=101','n=1001','n=101')
print '-depsc' 'c:/Users/Tomáš Valenta/Škola/Vejška/_bachelory thesis/zprava/obrazky/09_priklad_vykresleni_rady_detail.eps'