wave subtraction

Dear Community, 

Sorry that I am new here and I have too many questions. I have a wave that has 10 values. I want to subtract each value inside the wave from the value that is before it (except the first point), so point 2 - point1, point 3- point 2 and so on ..  and finally have these new values in a new wave or to substitute the original wave.

Is there a way of doing that? 

Many thanks in advance!

Differentiate does something a bit more complex than what the OP was asking for. It's quite possible that Differentiate is really what they want. However,...

For a wave called "wave0":

Duplicate wave0, wave0dif
wave0dif[1,] = wave0[p] - wave0[p-1]

You have to decide what goes into wave0dif[0].

Read more: DisplayHelpTopic "Waveform Arithmetic and Assignment"

I would strongly urge you to do the Guided Tour, which is part of the Getting Started help (Help->Getting Started). It takes a bit of time, but will save you more time in the future.

Dear all, 

Thank you very much for the valuable input. Actually both approaches worked for me except that when I used the differentiate function, I ran into the problem that the first point was always omitted for some reason. 

Differentiate/METH=1/EP=1 $waveofinterest

I tried to play around with the differentiate function but I could not find a way to retain the first value in the wave. 

The second method (wave0dif[1,] = wave0[p] - wave0[p-1]) worked fine.

I will do the guided tour and I think it is very helpful as a kick start. Many more thanks for the great help.

Differentiate/METH=1 does a forward difference, what you originally asked for was a backward difference. The forward difference is equivalent to this (I called my wave "junk"):

duplicate/O junk, junkmydif
•junkmydif[0,numpnts(junkmydif)-2] = junk[p+1] - junk[p]

Except for the treatment of the last point. Note that the difference isn't performed for the last point in the wave because junk[p+1] is out of range for the last point. Differentiate/EP=1 *deletes* that last point, /EP=0 *approximates* it. The approximation that is applied is to do a backward difference for that last point.

If you use /METH=2, you get what I originally posted, except for the *first* point. In that case, the difference goes into the destination starting at point 1, not point 0. The approximation that Differentiate applies is to use a forward difference for the first point, my example simply left the first point in place.