clear all; close all; f = (1:4)'; %Some frequencies w = 2*pi*f; ph = (0:.25:.75)'; tmax = 1; dt = 1/1024; t = 0:dt:tmax-dt; tl = length(t); ph = repmat(ph, 1, tl); vi = sin(w*t+ph); %The individual sinusoids figure plot (t, vi); v = sum(vi); figure plot(t,v) %plot of the reference signal grid on si=1:tl/16:tl; vs = zeros(1, tl); vs(si) = v(si); figure stem(t, vs) Vs = (tl/16)*fft(vs); f = 0:1/tmax: 1/dt-tmax; figure plot(f, 20*log10(abs(Vs))); ufi = 4; Vsf = Vs; Vsf(ufi+2:end-ufi) = eps; figure plot(f, 20*log10(abs(Vsf))); vsf = ifft(Vsf); figure plot(t, vsf) %This should match the reference signal grid on