Amplitude of env() is way higher than signal - scaling issue?

19 views
Skip to first unread message

Catherine Jameson

unread,
Dec 26, 2022, 11:42:09 AM12/26/22
to seewave
Hi all,

Hoping you can help me with an issue I'm encountering. I am using env() to find the amplitude of the signal, and to smooth out noise. This is a pulse signal (heart/pulse data from a ppg sensor).

Here's the code:
osc <- oscillo(data, sr, xaxt = "s", yaxt ="s")
par(new=TRUE)
envelope <- env(data, sr, envt = "abs", ssmooth = 200, colwave = "blue", yaxt = "s")

I turned on the yaxis labels so I could see that yes, indeed, even when I used envt = "abs" the envelope values are still much higher than the signal. 

For context, the data ranges from values about -40 to 40. The envelope values are between 1000-2000.

These somehow plot aligned well when I follow the example code exactly, however I need to use more advanced plotting tools as well as do some analysis on the envelope data. So, I need these variables to be aligned correctly. 

Essentially, what I am looking for is the env() function to return the top "edge" of the waveform. I hope I'm missing something basic, because this function is otherwise a lifesaver!!

Thanks for your help!
Catherine

Jérôme SUEUR

unread,
Jan 13, 2023, 8:23:54 AM1/13/23
to seewave GROUP
Dear Catherine,
This change of the amplitude values is due to the argument 'ssmooth' you are using. This argument computes the sum of the original absolute values over a specific sliding window (in your case a window made of 200 samples). The values then increase. 
If you wish to do compare different envelopes you can use the argument norm=TRUE so that the envelope is scaled between 0 and 1.
HTH
Jerome


De: "Catherine Jameson" <cjam...@wearenova.co>
À: "seewave GROUP" <see...@googlegroups.com>
Envoyé: Lundi 26 Décembre 2022 17:42:08
Objet: [seewave] Amplitude of env() is way higher than signal - scaling issue?

--
You received this message because you are subscribed to the Google Groups "seewave" group.
To unsubscribe from this group and stop receiving emails from it, send an email to seewave+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/seewave/9e8e9d0d-4eec-481c-aa0a-7c7282c9a819n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages