Convolution

This is best understood with an example. Suppose we have the following sets of equally spaced data:

1. Monthly degree days recorded for a city in a given year  (12 points - data set 1).

2. The gas used by the city during each month. in year 1 (12 points data set 2).

3. The prediction of the monthly degree days for year 2 (12 points data set 3).

We can prdict the gas used per month in the upcoming year 2, by inputting data sets one and two as curves B and C and doing a deconvolution providing the response function as curve A (A=C/B).  Now, enter the third set of data as B, and do a convolution against the response function and the output, curve C (C=A*B), is the predicted values of the gas usage in the upcoming year.

Well that was the example in the book.

 

Downloads:

Basic program (liberty basic) - convol.bas

 

Test case (data is embedded in program):

Convolution/Deconvolution

All curves must have the same number of data points.
Number of points to input? 12

0= End
1= Enter Curve A Data
2= Enter Curve B Data
3= Enter Curve C Data
4= Convolution:  C=A*B
5= Deconvolution: A=C/B
6= Deconvolution: B=C/A

 => 2
Use keyboard (k) or read from data (d) or quit (q)? d
1101
1048
715
318
141
9
0
0
33
280
483
763


0= End
1= Enter Curve A Data
2= Enter Curve B Data
3= Enter Curve C Data
4= Convolution:  C=A*B
5= Deconvolution: A=C/B
6= Deconvolution: B=C/A

 => 3
Use keyboard (k) or read from data (d) or quit (q)? d
173
215
196
93
73
41
32
27
29
29
71
125


0= End
1= Enter Curve A Data
2= Enter Curve B Data
3= Enter Curve C Data
4= Convolution:  C=A*B
5= Deconvolution: A=C/B
6= Deconvolution: B=C/A

 => 5

A(1)= 0.15712988
A(2)= 0.45711066e-1
A(3)= 0.0324677
A(4)= -0.21504872e-1
A(5)= 0.32362641e-1
A(6)= 0.388354e-2
A(7)= 0.60308497e-2
A(8)= 0.94019946e-2
A(9)= 0.36737617e-2
A(10)= -0.27097197e-1
A(11)= 0.28444333e-2
A(12)= -0.1044916e-1

0= End
1= Enter Curve A Data
2= Enter Curve B Data
3= Enter Curve C Data
4= Convolution:  C=A*B
5= Deconvolution: A=C/B
6= Deconvolution: B=C/A

 => 2
Use keyboard (k) or read from data (d) or quit (q)? d
984
1100
520
354
75
6
2
3
22
311
425
757


0= End
1= Enter Curve A Data
2= Enter Curve B Data
3= Enter Curve C Data
4= Convolution:  C=A*B
5= Deconvolution: A=C/B
6= Deconvolution: B=C/A

 => 4
C(1)= 154.615804
C(2)= 217.822559
C(3)= 163.937928
C(4)= 93.9474082
C(5)= 53.0391424
C(6)= 44.1024503
C(7)= 22.4457026
C(8)= 28.5060658
C(9)= 24.4250855
C(10)= 34.8143257
C(11)= 60.4171245
C(12)= 128.901933

0= End
1= Enter Curve A Data
2= Enter Curve B Data
3= Enter Curve C Data
4= Convolution:  C=A*B
5= Deconvolution: A=C/B
6= Deconvolution: B=C/A

 => 0