- are the peaks always positive?
- are the peaks always of this magnitude?
- can there be multiple peaks?
- is the trend always negative?
- etc...
Adjusting a baseline value on a curve that didn't baseline at zero
5 次查看(过去 30 天)
显示 更早的评论
First off, let me say thank you to Star Strider who has really helped me on some of my basic questions. I am new to MATLAB, so please forgive me if any of my questions are overly simplistic.
I am working with force curves from animal locomotion trials. Many times when working outside, drift will happen in the z-channel and baseline will be either above or below zero. I am wondering if there is anyway to correct for this.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/145577/image.jpeg)
If I was to do this manually, I would take the average distance between zero on both sides of the curve over some set time frame (i.e., red boxes), then I would take the average between both sides. I would take this value and add, or subtract sometimes, this value from all the points on my curve. This would effectively adjust of baseline.
I have no idea how to do this in MATLAB, and really would really appreciate if someone could help me with the code.
Thanks,
Michael
0 个评论
采纳的回答
Stephen23
2014-10-2
编辑:Stephen23
2014-10-2
Fitting a line/curve is probably the best way, and can be achieved several ways, with polyfit or a least squares fit of some kind.
The main trick is determining which data you want to fit to, in the example above you could use diff and only fit to the data which is similar to its neighbour (i.e. within some tolerance limit), and rejecting those points larger than some limit ( 0.1 * max(val) or similar).
Note that this method depends on what you know about how this trend varies between measurements, as this will affect how you have to model and fit this baseline trend:
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Curve Fitting Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!