How to create a linearly interpolated symbolic function from data?
이전 댓글 표시
I have measurements that can be described with unknown (and probably complicated) functions. I need symbolic functions that return the linear interpolated numbers between any two measurement points for any given time so I can define the Laplace-transforms of these functions. How can this be done?
댓글 수: 2
Kuifeng
2016년 4월 4일
Maybe elaborate more about your question with an example?
Tibor Guba
2016년 4월 5일
편집: Tibor Guba
2016년 4월 5일
답변 (1개)
Walter Roberson
2016년 4월 4일
Let x be the timepoints and y be the associated data values. Then for any time t between x(J) and x(J+1)
heaviside(t - x(J)) * heaviside(x(J+1) - t) * (y(J) + (t-x(J))/(x(J+1)-x(J)) * (y(J+1)-y(J))
so sum those formula over J = 1 to length(x)-1
I might have messed up the code slightly, as I simply wrote it out. It is the standard "origin plus a ratio of the change in value" calculation, together with a pair of heaviside that will only multiply to non-zero when the value is within the range.
Caution: you need to adjust this to take into account the value associated with heaviside(0), which there is no standard value for. Sometimes you want heaviside(0) to be 0, sometimes you want it to be 1, and it is not uncommon to see it defined as 1/2 . If it is defined as 0, then you need to use a dirac delta to add in the value at every boundary. If it is 1/2 then you need to use a dirac delta to add in half of the value at each boundary.
카테고리
도움말 센터 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
