I’m trying to do analysis on datasets that have a varying number of columns, but I need to use 3 columns per use of my equation. I want to use all columns in my dataset (with the exception of the first and last as they will not work) But I need to select a center column, the column before, and the column after. I need to implement these equations:
lower_actual = lower_original - dark;
lower_avg = sum(lower_actual)/length(lower_actual);
lower_gain = lower_avg./lower_actual;
upper_actual = upper_original - dark;
upper_avg = sum(upper_actual)/length(upper_actual);
upper_gain = upper_avg./upper_actual;
middle_actual = middle_original - dark;
x1 = lower_actual;
x2 = middle_actual;
x3 = upper_actual;
y1 = lower_gain;
y3 = upper_gain;
y2 = (((x2-x1).*(y3-y1))./(x3-x1))+y1;
interpolate = y2.*middle_actual;
In these equations the variables correlate to:
lower = column before
middle = center column
upper = column after
dark = first column in data set
Suppose you work on a matrix
M, e.g.Just loop over the columns skipping the first one and the last one.
The maximum column index which is fetched is
size(M, 2) - 3 + 2 == size(M, 2) - 1, i.e. the last column will be skipped.