Get Points from a Line (data set)

3 ビュー (過去 30 日間)
Gabs
Gabs 2015 年 10 月 20 日
コメント済み: Gabs 2015 年 10 月 20 日
I have a set of n data pairs (x,y), that are actual measurements. lets say x = [1 2 3 4 5 6 7 10]; and y = [100 200 300 400 500 600 700 800 900 1000];
I need to get estimated values that were not measured.
For example,
how can I find a "y" value within the plotting of that line (a simple plot(x,y) ) when x = 1.75, or x = 4.05 and so on?
Thank you

採用された回答

arich82
arich82 2015 年 10 月 20 日
編集済み: arich82 2015 年 10 月 20 日
[Edit to fix grammar and include output.]
It seems interp1 is the answer of the day...
x = [1 2 3 4 5 6 7 8 9 10]; % note: your given x didn't match numel(y)
y = [100 200 300 400 500 600 700 800 900 1000];
xq = [1.75, 4.05];
yq = interp1(x, y, xq)
figure;
plot(x, y, 'r-', xq, yq, 'k+')
Output:
yq =
175.0000 405.0000
Please accept this answer if it helps, or leave a comment if I missed something.
  1 件のコメント
Gabs
Gabs 2015 年 10 月 20 日
This did exactly what I wanted! Thanks!

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

その他の回答 (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