% x2 freqentiel N = 20; fe = 50*N*f0; Tps = [0 :1/fe: 1-1/fe]; for r = [1/2,1/3,1/4] a0 = r; x = a0 * ones(1,length(Tps)); for n = 1:N an = 2*sin(n*pi*r)/(n*pi); x = x + a0 + an*cos(n*2*pi*f0*Tps); end X=fft(x); Frq = [0 : fe/length(x) : fe - fe/length(x)]; figure plot(Frq,abs(X)); xlabel = "f"; ylabel = "Sx2(f)"; Title = "DSP de x2"; end