Sunday, June 6, 2010

matlab code, which generates blurred signal

In order to create convolution kernel, use h=triang(5);

Here is the matlab code, which generates your original signal x and
blurred signal y

%%%%%%%%%%%%%%%%%%%%%%%%%

n=100;
sigma_noise=0.05;

% Generate test signal
x=sprandn(100,1, 0.1); x=cumsum(x);


% Convolution kernel h and matrix A
h=triang(5);h=h/sum(h);
A=convmtx(h,n);

% measures signal y
y=A*x;
y=y + sigma_noise*randn(length(y),1)
;

figure;plot(x);hold on; plot(y)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%


No comments:

Post a Comment