% Makes a vertical blur distortion operator D 
% for use with image I and the file Dblur.m.
% I, blur must be defined in the workspace.

[m,n] = size(I);

nzmax = (2*blur+1)*m;
D = spalloc(m,m,nzmax);
d = -blur:blur; 
e = (1/(2*blur+1))*ones(m,length(d));
D = spdiags(e,d,m,m); 

figure('Units', 'Normalized', 'Position', [.05, .2, .4, .6])
spy(D)
title(strvcat('Vertical Blur Distortion Operator D',...
['(Entries have value 1/(2*blur+1) = ' , num2str(1/(2*blur+1)), ')']))

clear m n nzmax d e