Skip to content

Instantly share code, notes, and snippets.

@ntakouris
Created October 16, 2019 13:41
Show Gist options
  • Save ntakouris/510bed8fcbe031a3aeffeb76837bde62 to your computer and use it in GitHub Desktop.
Save ntakouris/510bed8fcbe031a3aeffeb76837bde62 to your computer and use it in GitHub Desktop.
h = 1/16 * [1, 4, 6, 4, 1];
sample_pts = -36:1:37;
sample_pts_1 = sample_pts(1:2:end);
signal = my_signal(sample_pts);
num_pts = size(signal, 2);
h_ = [h zeros(1, num_pts - 5)];
e = [1, zeros(1, num_pts - 1)];
T = toeplitz(1/16 * e, h_);
% fix this
D = eye(num_pts);
S = kron(D, [1, 0]);
g_1 = S * T * signal.';
% plot signal and gauss lv 1
plot(sample_pts, signal);
plot(sample_pts_1, g_1);
% upscale gauss
UPD = eye(size(sample_pts_1, 2) / 2);
UPS = kron(UPD, [0.5, 0.5]);
% find laplacian
UPG = UPS * g_1;
l_1 = signal - UPG;
function signal = my_signal(x)
% random polynomial or any func
signal = sin(x) ./ x;
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment