function [ ] = example1(  )
% This function creates a sine wave with added noise and displays it in
% figure 1.
% Then it uses this sine wave as current input for a leaky integrate and
% fire neuron displaying that neuron's membrane voltage (top) and action
% potential output (bottom) in figure 2.
% Thereafter, that spike output is low-pass filtered in figure 3 in an 
% attempt to treconstruct the current input to the neuron.
% Finally figure 4 shows an SNR analysis of that signal to gauge how strong
% the original sine wave is represented.

simufreq=1000;
dur=10;
freq=10;
amplitude=1;
noiseamplitude=.1;

figure(1)
[ns]=noisySinewave(dur,freq,simufreq,amplitude,noiseamplitude);
ns=ns+amplitude;

figure(2)
C=0.1;
timeconst1=0.2;
[iaf,m] = IandF(ns,simufreq,C,timeconst1,rand);

figure(3)
timeconst2=0.05;
[y]=IIRlowpass( iaf, simufreq, timeconst2 ); 

figure(4)
[fq,s]=sy(y,simufreq,3);
snd(fq,s,50,1,4);