Plotting a continuous-time signal and its spectrum
2
X(f) = ------------
2
1 + (2 pi f)
The following MATLAB program will plot x(t) and X(f) (in dB).
tmax = 5; % 5 time constants
t = -tmax:.001:tmax;
x = exp(-abs(t));
subplot(211)
plot(t,x)
xlabel('t (sec)')
ylabel('x(t)')
title('x(t) = exp(-|t|)');
f = -5:.001:5;
X = 2./(1+(2*pi*f).^2);
subplot(212)
plot(f,20*log10(abs(X)))
xlabel('f (Hz)')
ylabel('|X(f)| (dB)')