How I can produce the integration of digital signal data without knowing the function?
48 次查看(过去 30 天)
显示 更早的评论
SMY
2016-6-3
Hello all,
I have 512 acceleration data points. I want to integrate the data points to get the velocity and then the displacement data points by using Trapezium and Sympson's rules.
Example of my data points: x = [0 0.002 0.0039 0.0059 0.0078 0.0098 0.0117]; time(s) y = [-0.5570 0.1310 0.4010 0.0722 -0.5210 -0.8090 -0.7230]; acceleration (m/s2)
The problems happened when I looked around MATLAB code needs a function. By I dont.
Please advice.
Thank you for your time.
Regards, SMY
采纳的回答
Star Strider
2016-6-3
Use the cumtrapz function with your vector. It does not need a function.
15 个评论
SMY
2016-6-3
Thank you so much! The trapezium integration was working now. But how about the Simpson's rule? Did you have any idea on that?
Star Strider
2016-6-3
My pleasure!
You would have to use the quad function for Simpson’s rule, or write your own code for it. The Wikipedia article on Simpson’s rule seems to me to have code you can adapt to use vectors.
SMY
2016-6-3
Again.. thank you so much but unfortunately it seems difficult for me and I could not understand. :( However, thank you for your time and help.
Star Strider
2016-6-3
My pleasure.
It is not terribly difficult, but since this sounds like homework, I’m reluctant to develop code and send it to you.
SMY
2016-6-5
It not really homework to be honest. :) I am research student I really struggle with this coding since this not my area of research.
Star Strider
2016-6-5
Since it’s research, I’ll provide as much help as I can.
The problem is that every description I can find for Simpson’s rule indicates that it is only used with functions. I could find no references to it being used to integrate data. The result you got with cumtrapz is likely the best result you can get with empirical data.
You could always do a function fit to it (for example, a polynomial using polyfit and polyint to integrate it), or preferably a non-linear function that describes the process that created your data (estimating the parameters of that model), then integrate that function (analytically if possible), or with Simpson’s rule (the quad function), or integral.
SMY
2016-6-5
编辑:Star Strider
2016-6-5
Yes, I did it. I identified the best fit using polynomial quadrant.
What I found was when I used both quad and integral function the result will be the total of area under graph not the point instead. I also try quadv to find from 1 interval to another interval but it seems not right.
I found and currently try this -> http://uk.mathworks.com/matlabcentral/fileexchange/28726-simpson-s-rule-integration and really hope it can works.
Star Strider
2016-6-5
I have to admit that I did not look in the File Exchange (that I usually check first), probably because cumtrapz does what you want. That author apparently made Simpson’s rule work for vectors.
I hope it works for you. Please post back here if there is a significant difference between the cumtrapz and the Simpson’s rule function results. (I would trust the cumtrapz result.)
SMY
2016-6-5
For your information, my data is about signal processing. Yes, indeed. based on the theory the trapezium's rule better than simpson's rule and since I working with big frequency (Hz) therefore the trapezium will be better. But for my work, i need to check both for preparing myself when I presenting later.
I will let you know and share here. If not, it seems I give up. :D
Star Strider
2016-6-5
Interesting. I do a lot of biomedical signal processing.
You’re integrating accelerometer signals, so I would begin by doing a Fourier transform on them (each of the ‘X’, ‘Y’ and ‘Z’ directions) to define the signal spectrum and the noise spectrum.. In my experience they are easily separable. Then design a bandpass filter to separate out the gravitational constant and the noise (my filter design procedure is here: How to design a lowpass filter for ocean wave data in Matlab? although there are several ways to design discrete filters in MATLAB), then do the integrations on the filtered signals. Filter design is inherently experimental with respect to particular signals, so it will require some experimentation to get the filter characteristic and signal result that you want. Use the same filter on all of the channels, since you have used all of the channels to design your filter.
It is always best to use the fft function to analyse your signals first. Then filter them to eliminate as much noise as possible without eliminating any of your signal energy spectrum, then do whatever other processing on the filtered signals that you want to.
SMY
2016-6-5
Biomedical signal processing? Interesting. Mine is vibrational signal processing. My PhD is working in vibrations in steering wheel.
Thank you so much for the knowledge sharing. :)
Star Strider
2016-6-5
As always, my pleasure!
Steering wheel vibrations can contribute to human workload, and therefore to fatigue, and lower situational awareness. This relates to the postural reflexes that tend to keep the steering wheel steady, and so compensate for position changes constantly. (Workload metrics and related areas were also an area of my research many years ago.) Yours is an important area of human workload research, even if you never considered it in that context. Similar problems are acoustic noise and undercarriage vibrations, for the same reasons.
SMY
2016-6-6
I solved it!!
By referring to (https://youtu.be/364T-wFzBFM?list=PLgzRuzNES8Up4ib7hgo3O2y38LSQK138z)
From both trapezium and simpson's rules, from the graph it shows that simpson's rule was more clearly while trapezium bit compress maybe because simpson's rules are summations for 3 interval.
But for signal processing presentation, I will discuss further later with my supervisor.
But for now, to solve the integration by Simpson's rule, please refer to (https://youtu.be/364T-wFzBFM?list=PLgzRuzNES8Up4ib7hgo3O2y38LSQK138z)
Thank you Star Strider for your time!
Star Strider
2016-6-6
Congratulations!
Thank you for the links. I will look at them.
As always, my pleasure!
farzad
2020-4-16
dear Star, how do we check that we have not eliminated any energy from the signal by filtering it ? and is CWT the best option to filter ?
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Signal Processing Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!发生错误
由于页面发生更改,无法完成操作。请重新加载页面以查看其更新后的状态。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
亚太
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)