# Differences

This shows you the differences between two versions of the page.

 faq:what_does_padding_not_sufficient_for_requested_frequency_resolution_mean [2013/04/17 16:41]roemervandermeij faq:what_does_padding_not_sufficient_for_requested_frequency_resolution_mean [2017/08/17 11:21] (current) 2013/05/15 14:42 eelke explained easy way to get nice padding2013/04/17 16:41 roemervandermeij 2013/04/17 16:39 roemervandermeij 2013/04/17 16:32 roemervandermeij 2013/04/17 16:19 roemervandermeij created 2013/05/15 14:42 eelke explained easy way to get nice padding2013/04/17 16:41 roemervandermeij 2013/04/17 16:39 roemervandermeij 2013/04/17 16:32 roemervandermeij 2013/04/17 16:19 roemervandermeij created Line 7: Line 7: In order to do either of these, it is important to understand what the frequency resolution of your data is, and you can '​manipulate'​ it. The frequency resolution of any signal to be analyzed depends on the Rayleigh frequency of the data. The Rayleigh is equal to 1/T, with T being the time (in seconds) of the trial that you are analyzing. Using the Rayleigh frequency you can determine what frequencies can be estimated, namely: 0:​Rayhleigh:​Fsample/​2 (Fsample/2 being the Nyquist frequency). So, if the length of your trial is 2.350s and you sample your data at 1000 Hz, the frequencies you can estimate are 0:​(1/​2.35):​500. I.e. [0 0.4255 0.8511 1.2766 .... 499.1489 499.5745 500]. In order to do either of these, it is important to understand what the frequency resolution of your data is, and you can '​manipulate'​ it. The frequency resolution of any signal to be analyzed depends on the Rayleigh frequency of the data. The Rayleigh is equal to 1/T, with T being the time (in seconds) of the trial that you are analyzing. Using the Rayleigh frequency you can determine what frequencies can be estimated, namely: 0:​Rayhleigh:​Fsample/​2 (Fsample/2 being the Nyquist frequency). So, if the length of your trial is 2.350s and you sample your data at 1000 Hz, the frequencies you can estimate are 0:​(1/​2.35):​500. I.e. [0 0.4255 0.8511 1.2766 .... 499.1489 499.5745 500]. - Usually, this is undesirable because it is difficult to work with, and can change across trials if you have variable trial lengths. This last problem is solved by padding each trial out with zeros so they are all of equal length. This changes the frequencies you can estimate from your data by artificially creating longer T's (and thus changing the Rayleigh frequency). Importantly though, this does not (!) change the intrinsic frequency resolution of your data. The same trick can be used to solve the first problem. All you need to do is make sure you pad your data out to an integer number of seconds. So, setting your cfg.pad = ceil(max_trl_length),​ and you should get nice integer frequencies. + Usually, this is undesirable because it is difficult to work with, and can change across trials if you have variable trial lengths. This last problem is solved by padding each trial out with zeros so they are all of equal length. This changes the frequencies you can estimate from your data by artificially creating longer T's (and thus changing the Rayleigh frequency). Importantly though, this does not (!) change the intrinsic frequency resolution of your data. The same trick can be used to solve the first problem. All you need to do is make sure you pad your data out to an integer number of seconds. + An easy way to specify an appropriate integer seconds that is sure to fit the length of your maximum trial is to do + cfg.pad = ceil(max(cellfun(@numel,​ data.time)/​data.fsample));​