% script that visualizes the effects of % sampling and windowing global_decl; platform('octave'); %put either 'octave' or 'matlab' a = - 10.0; b = 100; s0 = a + i * b; t = [0:0.001:1]; y = exp(s0*t); % complex exponential subplot(2,2,1); plot(t,real(y)); eval(mygridon); title('Exponentially-decayed sinusoid'); xlabel('t [s]'); ylabel('y'); eval(myreplot); pause; f = [0:0.1:100]; Y = 1 ./ (i * 2 * pi * f - s0*ones(size(f))); % closed-form Fourier transform subplot(2,2,2); plot(f, 20*log10(abs(Y)), '-'); title('Frequency response of a damped sinusoid'); xlabel('f [Hz]'); ylabel('|Y| [dB]'); hold on; Fs = 50; Ysamp = 1 ./ (1 - exp(s0/Fs) * exp(- i*2*pi*f/Fs)) / Fs; % closed-form Fourier transform of the sampled signal plot(f,20*log10(abs(Ysamp)),'--'); n = [0:6]; y = exp(s0*n/Fs); Ysampw = y * exp(-i*2*pi/Fs*n'*f) / Fs; % Fourier transform of the windowed signal % obtained by vector-matrix multiply plot(f,20*log10(abs(Ysampw)),'-.'); hold off; eval(myreplot); % print -deps2 'sindf.eps');