I have a Matrix defined as follows:
wvp =
Matrix[[-40.0,0.006],[0.0,0.045],[32.0,0.18],[59.0,0.50],[70.0,0.74],
[100.0,1.93],[130.0,4.53]]
I want to interpolate within this 2D array, which I start to do with
the following equation:
m = (wvp[i,2]-wvp[i-1,2])/(wvp[i,1]-wvp[i-1,1])
This is readily done in C, but Ruby does not like the fact that I
subtract a one from the index i within the context of the array, i.e.,
[i-1,2]. Even if I try to fake it out by first declaring j = i - 1, and
using j in place of the i-1 within the array coordinate, I get the
following error:
C:\rails_projects\TestRubyConcepts\lib\main.rb:74:in
humidity_correction': undefined method
-’ for nil:NilClass
(NoMethodError)
It’s claiming my method - is undefined. How do I defeat this?