extracting values at set intervals from a vector

3 ビュー (過去 30 日間)
Richard
Richard 2012 年 11 月 6 日
From the following vector:
depth = [0:0.1:20];
How could I create a new vector that had the same data as 'depth' but a value taken every 0.5, providing an outcome of:
d2 = depth(1:5:end);
Since my data is not actually spaced at 0.1 intervals but at randomly distributed intervals I cannot apply the simple approach shown above. What would be the best methods of achieving this?

回答 (1 件)

Jan
Jan 2012 年 11 月 6 日
Use interp1 for a linear interpolation.
  1 件のコメント
Richard
Richard 2012 年 11 月 6 日
編集済み: Richard 2012 年 11 月 6 日
Is there another way o doing this, the overall aim of what I am attempting to achieve is to measure the uncertainty of interpolation methods. Isn't there a method for taking the first value and then every value in the vector which is + 0.5 of the last? maybe use floor if they are not exact?

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

カテゴリ

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