Integration the product of two data sets
조회 수: 4 (최근 30일)
이전 댓글 표시
I have two data sets, acceleration vs velocity v and an another function P(v) vs v. Now I have to integrate the product of these two i.e acc * P(v) wrt to v. My problem is the size and elements of velocity v in both these data sets(they are in form of four different arrays) is not same, i.e the array v in the first set(with acceleration) goes 15,20,25,...kph while the other v array goes 15,16,17...etc. So how to use trapz here? Or would it be better for me to get two analytical curves, acc vs v and P vs v, using curve fitting and then integrate their product?
댓글 수: 0
답변 (1개)
Roger Stafford
2014년 3월 28일
You cannot use 'trapz' on the two sets of data as they stand. To get an accurate integral of the product, the two factors must correspond to the same values of v. I would suggest you interpolate one of the sets of data, presumably the one with the coarser intervals, onto the closer-spaced values of v of the other factor, and then use 'trapz' on that common set of v values for the product.
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!