Illustrate truncated SVD
using Plots
using LaTeXStrings
default(linewidth=3, labelfontsize=16, tickfontsize=12, legendfontsize=14)
delta = 0.12
sig = sort([delta-eps(); delta+eps(); range(0, 2, 201)...]) # σ
f0 = 1 ./ sig
f1 = copy(f0)
f1[sig .< delta] .= 0
beta = 2.0^-8
f2 = sig ./ (sig.^2 .+ beta);
plot(xaxis=(L"\sigma", (0,2), ([0, delta, 1, 2], ["0", L"δ", "1", "2"])),
aspect_ratio=0.15, # for book figure
yaxis=(L"1 / \sigma", (0, 20), 0:10:20))
plot!(sig, f0, color=:blue, label=L"1 / \sigma")
plot!(sig, f1, line=:red, label="Truncated SVD")
plot!(sig, f2, line=:magenta, label="Tikhonov")
#savefig("fig_trunc_svd1.pdf")