function x=expf2filt(t,terms,resistor)
x=0.5;
count=1;
while count <= terms
	coeff = 0.5 * ((exp(-j*count*pi)-1) / (j*count*pi))^2;
    % account for filter on signal with variable resistance
    coeff = coeff/(1+j*count*pi*resistor*0.000318);
    harmonic = coeff*exp(-j*count*pi*t);
    % negate count to get the negative harmonic
    count = -count;
   	coeffneg = 0.5 * ((exp(-j*count*pi)-1) / (j*count*pi))^2;
    % account for filter on signal with variable resistance
    coeffneg = coeffneg/(1+j*count*pi*resistor*0.000318);
    harmonicneg = coeffneg*exp(-j*count*pi*t);
    % negate count again to continue in the loop
    count = -count;
    
	x=x + harmonic + harmonicneg;
    count = count+1;
end
