% Orizoume mia timh gia to A
A = 1;

% Diamerizoume ton a3ona tou xronou ana dt 
dt = 0.001;

% Orizoume mia timh gia thn periodo T0
T0 = 1; 

% Orizoume ton a3ona tou xronou (4 periodoi)
t = 0:dt:4*T0;

% Posa hmitona 8eloume? Estw 40...
N = 40;

% pollaplasia tou k me bhma 1
k = 1:1:N;

% H mesh timh
C0 = A/2;

% Oi syntelestes twn synhmitonwn
Ck = A./(k*pi);

% Pra3h! (prose3te pws apofeugoume th xrhsh for loop)
x = C0 + Ck*cos(2*pi*k'/T0*t + pi/2);

% Apeikonish
plot(t, x); xlabel('Time (s)'); Title('It works!');