Is there any way to fix frequency using the fit() function and “sin”?
1 次查看(过去 30 天)
显示 更早的评论
I am using the fit() function with a 'sin' model. Is there a way to fix the frequency? As I am analyzing the data for circadian rhythm of cardiac functions, the frequency should be 1 for 24 hours data, 2 for 48 hours data and 3 for 72 hours data.
After I get the “fit”, I will calculate the amplitude (peak value from the mean value) and acrophase (the timing of the peak values) of those data.
Is there any way to do so?
0 个评论
回答(2 个)
Walter Roberson
2021-11-27
No. You should create a custom model for that.
Are you sure that you want the frequency to be 2 for 48 hours data? As in sin(2*pi*F*t) and you would want F to be 2 for 48 hours data? Frequency is cycles per unit time, and the unit time is the same for 24 hours as for 48 hours, so however many cycles you are expecting for 24 hours, frequency 2 for 48 hours would imply that you would want 4 times as many cycles. For example if the unit time is "days" then frequency 1 for 24 hours would be one full cycle, but frequency 2 for 48 hours would be 2 full cycles for the first 24 hours, and an addtional 2 full cycles for the second 24 hours, for a total of 4 full cycles.
It is not clear to me that a fixed frequency is justifiable in circadian rhythm studies. Isn't part of the hypothesis that the person might have a different rhythm ?
If you really did have a fixed frequency, just with unknown amplitude and phase, then it seems to me there would be other ways of recovering those values. But I am not presently convinced that fixed frequency can be justified.
0 个评论
Ken Takahashi
2021-11-27
2 个评论
Walter Roberson
2021-11-27
I suggest you take the signal, subtract the mean of the signal, fft(), take the first half of the array, find the peak absolute value. Convert the index of the maximum value into a frequency according to the time separation -- index 1 should never be the peak; index 2 would be the peak if the frequency is 1 cycle over the elapsed time of the test; index 3 would be the peak if the frequency is 2 cycles over the elapsed time of the test, and so on. See the first example in the fft() documentation to see how to calculate the frequency vector.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Biological and Health Sciences 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!