MATLAB: Plotting dirac delta function’s spectrum

plot

I used the following code to plot the spectrum of some functions. but it doesn't work for the function dirac(t-t0) at t0=0. How can I fix it?
syms t w;
syms g h U;
g(w)=fourier(dirac(t));
h=abs(g);
w=-10:.5:10.1;
U=angle(g);
figure;
plot(w, subs(h));
figure;
plot(w,subs(U));

Best Answer

The Fourier (and Laplace) transforms of the Dirac delta function are uniformly 1 for all omega (or ā€˜sā€™).
That is the result you get in ā€˜g(w)ā€™.
Related Question