% Creating simple signals for use in convolution
% and correlation demos.
% SimpleSignals.m   L. Braile 03/24/2005
% boxcar signal of length n1
n1 = 5;
s1 = ones(1,n1); % row vector of ones
% attach some zeros to ends of boxcar n1 = previous n1 + 4
s1 = [0 0 s1 0 0];
% delta function at location n2/2 + 1 where n2 is odd
n2 = 13;
nh = (n2 -1)/2;
temp = zeros(1,nh);
s2 = [temp 1 temp]; % row vector with spike in center
% triangle function of half-width n3 where n3 is odd
n3 = 7;
nh = (n3 -1)/2;
s3 = [(1:1:nh) nh+1 (nh:-1:1)]; % row vector triangle
s3 = s3/max(s3); % scale to a maximum value of one
% simple wavelet
temp = [0 0.3 1.5 3 0 -3 -2 0.8 0.8 0.1 0]; % coarse sample interval
nt = length(temp);
n4 = 2*nt;
t1 = [0:1:nt-1];
t2 = [0:0.5:nt-1];
s4 = spline(t1,temp,t2); % interpolate to ~ twice as many samples
% simple wavelet "buried" in noise (begins at location 50)
s5 = randn(1,100); % make random noise scaled to std of 1
nt = length(s4);
s5(50:50+nt-1) = s5(50:50+nt-1) + s4(1:nt); % add signal to noise
plot(s1)
figure 
plot(s2)
figure 
plot(s3)
figure 
plot(s4)
figure 
plot(s5)


