#pragma rtGlobals=1 // Use modern global access method. menu "macros" submenu "Analysis of the graph between the two cursors" "Find the area of the oscillation", oscarea() "Find the deltaY between two points", oscamp() "Find the deltaX between two points", interpeak2() "Print the analysed values and kill the wave", printwave() end end function oscarea() string intwave = CsrWave(A) wave wave2int = $intwave variable pointdif variable baseline variable oscillation variable areaofosc variable n string p pointdif = xcsr(B) - xcsr(A) baseline = pointdif * (( vcsr(A) + vcsr(B))/2) oscillation = area(wave2int,xcsr(A),xcsr(B)) areaofosc = sqrt((oscillation - baseline)*(oscillation - baseline)) //can include these parts below if you want to //print pointdif //print baseline //print oscillation //print areaofosc collatewave(areaofosc) end //function interpeak() //print (sqrt((hcsr(A) - hcsr(B))*(hcsr(A) - hcsr(B))))/1000 //end function oscamp() variable amp, amp2 amp = vcsr(A) - vcsr(B) amp2 = (sqrt(amp*amp))/1000 //print amp2 collatewave(amp2) end function interpeak2() variable distance, distance2 distance = xcsr(A) - xcsr(B) distance2 = (sqrt(distance*distance))*2 //print distance2 collatewave(distance2) end //function makewave() //make analysiswave = {0} //print analysiswave //end function collatewave(n) variable n wave analysiswave variable p if (!waveexists(analysiswave)) make analysiswave = {0} endif analysiswave [0] = n insertpoints 0,1, analysiswave //print analysiswave end function printwave() wave analysiswave deletepoints 0,1, analysiswave wavetransform/o flip analysiswave print/f analysiswave killwaves analysiswave end