t=(-2*pi*(1.0e-3)):1.0e-5:(2*pi*(1.0e-3));
Sum=0.5;  %this is the DC value
Omegao=1000;
C=1.0e-4; %value of capacitor
L=1.0e-2; %value of inductor
for n=1:99  %repeat for a number of hamrmonics
    Exponent=((n-1)/2)
    Sum=Sum+(1/(n*pi))*sin(n*pi/2)*((i*n*Omegao*C)/(1-(n*n*Omegao*Omegao*L*C)+(i*n*Omegao*C)))*exp(i*n*Omegao*t);  %add contibutions from positive frequency
    Sum=Sum++(1/(n*pi))*sin(n*pi/2)*((-i*n*Omegao*C)/(1-(n*n*Omegao*Omegao*L*C)+(-i*n*Omegao*C)))*exp(-i*n*Omegao*t); %add contribution from negative frequency
end
plot(t,Sum)
    