fs = 44100; % Sampling frequency
Ts = 1/fs; % Time step
t1 = 0 : 2*pi*Ts : 2*pi;
x1 = square(t1);
y1 = 0;
for i = 1 : 8
% Use your Fourier Series calculation result in the following
y1 = y1+sin(t1*(2*i-1))/(2*i-1);
end
% Plot the time domain figure x1 and y1 in the following
figure;
hold on;
plot(t1, x1,'LineWidth',2);
plot(t1, y1,'.-','LineWidth',2);
hold off;
You can scale the time axis by dividing t1 and you can equalise the square waves with a factor of 4/5:
period = 5e-3;
t1 = t1*period/(2*pi);
y1 = 5*y1/4;
figure;
hold on;
plot(t1, x1,'LineWidth',2);
plot(t1, y1,'.-','LineWidth',2);
hold off;
xlabel('Time [s]');
ylabel('Current [A]');