Forum: open-discussion
Monitor Forum | | RE: Frequency Analysis for 300 seconds window [ Reply ] By: Abraham Otero on 2022-05-06 06:44 | [forum:49390] |
|
The function CalculateEnergyInPSDBands calculates the global energy in the four frequency bands, regardless of the time instant. The function that does what you want is CalculatePowerBand. After invoking it, the spectral power in each time window has been stored in hrv.data$FreqAnalysis[[1]]$ULF hrv.data$FreqAnalysis[[1]]$VLF hrv.data$FreqAnalysis[[1]]$LF hrv.data$FreqAnalysis[[1]]$HF Note that when calling the function using wavelets, it doesn't make sense to specify the size and shift parameters. If you are not familiar with wavelets, I recommend changing the analysis type to fourier. |
|
| Frequency Analysis for 300 seconds window [ Reply ] By: Tomas FariƱa on 2022-05-03 18:50 | [forum:49389] |
|
I collect ECG data that last more than 30 minutes. I want to perform Time and Frequency domain analysis but I would like to get the information of every 5 min window, so I can choose which window will use for my comparisons. So, I load the data and CreateTimeAnalysis and CreateFreqAnalysis (I use to list in order to analyse it using Lomb and wavelets). The problem is that I can`t get the information for every 5 min window but I get the whole data of every single time Time point (for example, a list of >800 numbers). How can I do the segmented analysis and get numbers and plots? Here is my code: # HRVData structure containing the heart beats data("HRVData") # HRVData structure storing the results of processing the # heart beats: the beats have been filtered, interpolated, ... data("HRVProcessedData") hrv.data = CreateHRVData() hrv.data = SetVerbose(hrv.data, TRUE ) hrv.data = LoadBeatAscii(hrv.data, "ECG_1-ing_final.csv") hrv.data = BuildNIHR(hrv.data) hrv.data = FilterNIHR(hrv.data) hrv.data = SetVerbose(hrv.data,TRUE) hrv.data = EditNIHR(hrv.data) hrv.data = InterpolateNIHR(hrv.data, freqhr = 4) PlotNIHR(hrv.data, main = "niHR") PlotHR(hrv.data,main="iHR") #Interpolated HR hrv.data = CreateTimeAnalysis(hrv.data, size = 300, interval = 7.8125) hrv.data = CreateFreqAnalysis(hrv.data) hrv.data = SetVerbose(hrv.data,TRUE) hrv.data=CalculatePowerBand(hrv.data, indexFreqAnalysis = 1,size=300, shift=30, type = "wavelet", wavelet = "la8", bandtolerance = 0.01, relative = FALSE, ULFmin = 0, ULFmax = 0.03, VLFmin = 0.03, VLFmax = 0.05, LFmin = 0.05, LFmax = 0.15, HFmin = 0.15, HFmax = 0.4 ) # Plotting wavelet analysis PlotPowerBand(hrv.data, indexFreqAnalysis = 1, normalized=TRUE, hr=TRUE) hrv.data=CalculatePSD(hrv.data,indexFreqAnalysis = 1, method = "lomb", doPlot="F") CalculateEnergyInPSDBands(hrv.data, indexFreqAnalysis =1) This last line just gives me four values that, I suppose, are for the entire time series. Example: [1] 161.109 30.242 24.157 54.99 |
|

