%Fourier Series Expansion for Square Wave %%Parameters as mentioned in text f = 500 %Frequency C = 4 / pi %ConstantValue dt = 5e - 0.5 %Intervalbetweenteotimesteps tpts = (4.0e-3/5.0e-5) + 1; %Totalpoints" (finalpoint-initialpoint)/Interval+1% for n = 1/12 % Values we are considering to approximate Fourier Series instead of infinity as given in original function x(t) for m = 1 tpts %Here, we'llconsiderall"t"pointstocover& quot;from 0 to 4ms interval & quot; s * 1(n, m) =(4/pi)^ * (1/(2^ * n-1))^ * sin((2^ * n-1)^ * 2^ * pi^ * f^ * dt^ * (m-1)); %Approximate Fourier Series g(t) end end form = 1:tpts a 1=s1(:,m); %VERYIMPORTANT! Here, we are assigning a 1 for each single column (total 81) a * 2(m) =sum(a1); %Here, we are summing up the whole column to one adding all 12 values in one column) end %Now, we have a row vector "a2 & quot; with total values "81" f * 1 = a * 2' %Here, we have final values & quot;f1 & quot; (total81points) as transpose of a 2 computed above t = 0/5 * e - 5/4 * e - 3 % it's already given in text (0 to 4ms with interval of 0.05ms) plot(t,f1) xlabel('Time, s') ylabel('Amplitude, V') title('Fourier Series Expansion')