splitting up a timeseries into separate components

3 views (last 30 days)
hi all!
I am trying to seperate chunks of a timeseries into sleep vs. wake components.
I'm having problems with two things:
1) I've figured out how to do it with one section, but I want to be able to do it with multiple sections, e.g. 200-600 seconds and 750-800 seconds.
2) I also want to take these chunks of the timeseries and then calculate the power. When I try to run my script to calculate the power, I get a ton of errors I think because sleep_c (etc) is = 1x1 double times, rather than my normal ts = 1000x1 double
thanks times a million:
I've done this:
%%%%loading
sleep_behavior = 1500:3000
sleep_c = timeseries(d_c_ts_1(sleep_behavior,1), 1500:3000,'name', 'fMRI signal')
sleep_behavior = 1500:3000
sleep_v = timeseries(d_v_ts_1(sleep_behavior,1), 1500:3000,'name', 'fMRI signal')
wake_behavior = 100:200
wake_c = timeseries(d_c_ts_1(wake_behavior,1), 100:200,'name', 'fMRI signal')
wake_behavior = 100:200
wake_v = timeseries(d_v_ts_1(wake_behavior,1), 100:200,'name', 'fMRI signal')
%% calculating power of sleep vs. wake ----- power vs. frequency
for a = 1:1
name = sleep_v
[power_sleep_v, f] = mtspectrumc(name,params) %detrended cortex young person
end

Accepted Answer

nines
nines on 20 Feb 2020
hello!
found a good function for anyone in the future:
https://github.com/VincentToups/matlab-utils/blob/master/chronux/documentation/chronux_2_00/spectral_analysis/continuous/mtspectrumtrigc.html

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!