Differentiate Formula
JBertrand
I am collecting analog electrical data and need to take periodic slopes from my curve. It is fairly noisy but I can easily get rid of that with smoothing. What I really need to be able to do is apply the following equation to my 1D wave.
f'=(f(point + h)-f(point))/h h= width of "box"
The differentiate function does a point by point differentiation. This not appropriate for me, I need to be able to set the width of the "box" and calculate a slope from it. I am not familiar enough with Igor Pro 5 to write the function. Any guidance would be very much appreciated.
Regards,
JBertrand
Wave w
Variable h
Variable xx
Variable h2= h/2
Variable val1= w(xx-h2)
Variable val2= w(xx+h2)
Variable slope= (val2-val1)/h // central difference
return slope
End
Then create a wave to hold the slopes and apply the function using x as the index in the wave assignment. For example:
Setscale/P x, 1, 0.25, "", data
Duplicate/O data, dataDiff
dataDiff= WideSlope(data,0.5,x)
See the attached graph, too.
--Jim Prouty
Software Engineer, WaveMetrics, Inc.
March 8, 2011 at 10:12 pm - Permalink