fs = 1e6; T = 1/fs; Td = T; fx = fs/29; t = 0:T:1.2/fx; x = sin(2*pi*fx.*t); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % time domain plot(t, x, 'o'); hold on; stairs(t, x, 'r'); legend('sampled data', 'after ZOH', 3); xlabel('Time'); ylabel('Amplitude'); hold off; fixfig; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % spectra f = linspace(0, 3*fs, 900); h = (abs(cos(pi*f/fs)) .^ 0.2) - 0.8; h(h < 0) = 0; h = h/h(1); s = abs(sinc(f * Td)); subplot(3, 1, 1); plot(f, h); ylabel('DAC Input'); fixfig; subplot(3, 1, 2); plot(f, s); ylabel('sinc'); fixfig; subplot(3, 1, 3); plot(f, h.*s); ylabel('DAC Output'); fixfig; xlabel('Frequency');