フィルターのクリア

linear interpolation using 2 arrays

4 ビュー (過去 30 日間)
jgillis16
jgillis16 2017 年 4 月 12 日
コメント済み: jgillis16 2017 年 4 月 14 日
I have two separate arrays containing two variables, t & T. I need to interpolate for a new set of T values using the relationship between t and T.
for k=1:length(t)
[t, index] = unique(t);
tr_T = interp1(t,T(index),'linear'); %linear interpolation to find new T given t
end
However, the shape of the original T curve is not retained after I interpolate and derive the tr_T values. Any ideas?
  4 件のコメント
Jan
Jan 2017 年 4 月 12 日
編集済み: Jan 2017 年 4 月 12 日
The "yellow" curve is red, isn't it?
The intention of the shown code is not clear. Calculating "[t, index] = unique(t)" repeatedly in each iteration does not change the result and tr_T is overwritten again and again.
What are the two arrays t and T? Why do you use the indices of the unique value of t to get values from T? This looks strange.
jgillis16
jgillis16 2017 年 4 月 14 日
the color question - not necessary.
***written in the next cell - both t and T are arrays on the order of ~6400 cells.
t = time; T = temperature.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeInterpolation についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by