Fourier transforms of a sine wave using a Pluto.jl notebook: The interactive notebook can be run on binder, but be patient 😴.
begin using Plots, PlutoUI function DFT_plot(ω₀, N) f(ω) = abs(sin(N*ω/2)/sin(ω/2)) ω_DFT = (0:N-1)*2π/N plot(ω -> f(ω - ω₀), 0, 2π, label="Fourier transform", xlabel="ω", w=2) plot!(ω_DFT, f.(ω_DFT .- ω₀), line = :stem, label="Discrete Fourier Transform", marker = :circle, w=2) vline!([ω₀], label="ω₀ = $(round(ω₀, digits=2))", w=3) title!("Fourier transforms of x(n)=exp(jω₀n), n=1…$N") end end begin ω₀Slider = @bind ω₀ Slider(0:1E-2:2π, default = 0.