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!
