How do I do numerical integration of a vector in MATLAB?

后端 未结 3 585
时光说笑
时光说笑 2020-12-17 03:54

I have a vector of 358 numbers. I\'d like to make a numerical integration of this vector, but I don\'t know the function of this one.

I found that we can use trapz o

3条回答
  •  轮回少年
    2020-12-17 04:17

    Think about integration as to find area under the curve, which is formed by your vector. Well it's not actually a curve, but polygonal chain. What TRAPZ function is doing, it finds sum of areas of each trapezoids formed by every two neighbor points in your vector and their projection on X axis. See the function documentation, if you have uneven distance between your points or if distance not equal one.

    You can read more about this method, for example, on Wikipedia.

提交回复
热议问题