Vector creation with information of other vector

2 ビュー (過去 30 日間)
Emmanuelle
Emmanuelle 2012 年 9 月 26 日
Hi,
I have a question about the creation of a vector. On one hand, I have two vectors:
m1x= [550 560 562 562 645]
m1y= [0.003 0.0005 0.0008 0.0002 0.012]
And on the other hand, I have another one:
l1x= [560 580 562 546 524]
With m1x and m1y I've done a interpolation and I have values for each number from 550 to 645. I've saved that information in a new vector. The interpolation vector is like this:
a1x= [550 551 552 553 554 555 556 ...]
a2x= [0.002 0.02 0.002 0.06 0.08 0.07 ...]
My purpose is to create another vector and I want to obtain the y values from the l1x vector values (using the results of the interpolation vector). So, for example I want a vector like this:
l1x= [560 580 562 546 524]
l1y (this is the new vector)= [0.005 0.005 (this number is from the vector of interpolation) 0.0008...].
How can I indicate to the code that I want some specific numbers from the interpolation data to the new vector?
Greetings and thanks in advance,
Emma

採用された回答

Andrei Bobrov
Andrei Bobrov 2012 年 9 月 26 日
編集済み: Andrei Bobrov 2012 年 9 月 26 日
m1x= [550 560 562 562 645];
m1x = m1x+[false, diff(m1x) == 0]*eps(1000);
pp = interp1(m1x,m1y,'linear','pp');
l1x= [560 580 562 546 524];
out = ppval(pp,l1x);
  1 件のコメント
Emmanuelle
Emmanuelle 2012 年 9 月 27 日
Thanks Andrei!

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

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